//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
}
