24 lines
394 B
Go
24 lines
394 B
Go
// Copyright (c) HashiCorp, Inc.
|
|
// SPDX-License-Identifier: BUSL-1.1
|
|
|
|
//go:build !windows
|
|
|
|
package diagnose
|
|
|
|
import (
|
|
"io/fs"
|
|
|
|
"github.com/hashicorp/vault/helper/osutil"
|
|
)
|
|
|
|
// IsOwnedByRoot checks if a file is owned by root
|
|
func IsOwnedByRoot(info fs.FileInfo) bool {
|
|
if !osutil.FileUIDEqual(info, 0) {
|
|
return false
|
|
}
|
|
if !osutil.FileGIDEqual(info, 0) {
|
|
return false
|
|
}
|
|
return true
|
|
}
|