e38f991054
* raft file and quorum checks * raft checks * backup * raft file checks test * address comments and add more raft and file and process checks * syntax issues * modularize functions to compile differently on different os * compile raft checks everywhere * more build tag issues * raft-diagnose * correct file permission checks * upgrade tests and add a getConfigOffline test that currently does not work * comment * update file checks method signature on windows * Update physical/raft/raft_test.go Co-authored-by: Brian Kassouf <briankassouf@users.noreply.github.com> * raft tests * add todo comment for windows root ownership * voter count message * raft checks test fixes Co-authored-by: Brian Kassouf <briankassouf@users.noreply.github.com>
21 lines
328 B
Go
21 lines
328 B
Go
// +build !windows
|
|
|
|
package diagnose
|
|
|
|
import (
|
|
"io/fs"
|
|
"syscall"
|
|
)
|
|
|
|
// IsOwnedByRoot checks if a file is owned by root
|
|
func IsOwnedByRoot(info fs.FileInfo) bool {
|
|
if stat, ok := info.Sys().(*syscall.Stat_t); ok {
|
|
uid := int(stat.Uid)
|
|
gid := int(stat.Gid)
|
|
if uid == 0 && gid == 0 {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|