open-vault/vault/diagnose/file_checks_unix.go
Hamid Ghaf 27bb03bbc0
adding copyright header (#19555)
* adding copyright header

* fix fmt and a test
2023-03-15 09:00:52 -07:00

24 lines
393 B
Go

// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
//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
}