package engine import ( "os" "syscall" ) // copyOwner gives path the owner and group of fi (when running as root). func copyOwner(fi os.FileInfo, path string) { if st, ok := fi.Sys().(*syscall.Stat_t); ok && os.Geteuid() == 0 { os.Chown(path, int(st.Uid), int(st.Gid)) } }