mirror of
https://github.com/containers/podman.git
synced 2025-09-12 01:38:59 +08:00
Vendor in the latest containers/storage, image and buildah
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
10
vendor/github.com/containers/storage/drivers/chown_unix.go
generated
vendored
10
vendor/github.com/containers/storage/drivers/chown_unix.go
generated
vendored
@ -45,10 +45,20 @@ func platformLChown(path string, info os.FileInfo, toHost, toContainer *idtools.
|
||||
uid, gid = mappedPair.UID, mappedPair.GID
|
||||
}
|
||||
if uid != int(st.Uid) || gid != int(st.Gid) {
|
||||
stat, err := os.Lstat(path)
|
||||
if err != nil {
|
||||
return fmt.Errorf("%s: lstat(%q): %v", os.Args[0], path, err)
|
||||
}
|
||||
// Make the change.
|
||||
if err := syscall.Lchown(path, uid, gid); err != nil {
|
||||
return fmt.Errorf("%s: chown(%q): %v", os.Args[0], path, err)
|
||||
}
|
||||
// Restore the SUID and SGID bits if they were originally set.
|
||||
if (stat.Mode()&os.ModeSymlink == 0) && stat.Mode()&(os.ModeSetuid|os.ModeSetgid) != 0 {
|
||||
if err := os.Chmod(path, stat.Mode()); err != nil {
|
||||
return fmt.Errorf("%s: chmod(%q): %v", os.Args[0], path, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
Reference in New Issue
Block a user