mirror of
https://github.com/mikefarah/yq.git
synced 2024-12-19 20:19:04 +00:00
19 lines
284 B
Go
19 lines
284 B
Go
//go:build linux
|
|
|
|
package yqlib
|
|
|
|
import (
|
|
"io/fs"
|
|
"os"
|
|
"syscall"
|
|
)
|
|
|
|
func changeOwner(info fs.FileInfo, file *os.File) error {
|
|
if stat, ok := info.Sys().(*syscall.Stat_t); ok {
|
|
uid := int(stat.Uid)
|
|
gid := int(stat.Gid)
|
|
return os.Chown(file.Name(), uid, gid)
|
|
}
|
|
return nil
|
|
}
|