mirror of
https://github.com/warmbly/warmbly.git
synced 2026-11-29 08:06:27 +00:00
22 lines
347 B
Go
22 lines
347 B
Go
//go:build unix
|
|
|
|
package updater
|
|
|
|
import (
|
|
"os"
|
|
"syscall"
|
|
)
|
|
|
|
// ownerOf returns the uid and gid owning path.
|
|
func ownerOf(path string) (uid, gid int, ok bool) {
|
|
info, err := os.Stat(path)
|
|
if err != nil {
|
|
return 0, 0, false
|
|
}
|
|
st, ok := info.Sys().(*syscall.Stat_t)
|
|
if !ok {
|
|
return 0, 0, false
|
|
}
|
|
return int(st.Uid), int(st.Gid), true
|
|
}
|