graphdriver.platformLChown: improve errors
Functions from os package, such as os.Lchown or os.Chmod, return an os.PathError which already contains the operation and the file name, so there is no need to add them one more time. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
parent
fa9f65d202
commit
3a1bcb0e4b
|
|
@ -55,12 +55,12 @@ func platformLChown(path string, info os.FileInfo, toHost, toContainer *idtools.
|
|||
|
||||
// Make the change.
|
||||
if err := os.Lchown(path, uid, gid); err != nil {
|
||||
return fmt.Errorf("%s: chown(%q): %v", os.Args[0], path, err)
|
||||
return fmt.Errorf("%s: %v", os.Args[0], err)
|
||||
}
|
||||
// Restore the SUID and SGID bits if they were originally set.
|
||||
if (info.Mode()&os.ModeSymlink == 0) && info.Mode()&(os.ModeSetuid|os.ModeSetgid) != 0 {
|
||||
if err := os.Chmod(path, info.Mode()); err != nil {
|
||||
return fmt.Errorf("%s: chmod(%q): %v", os.Args[0], path, err)
|
||||
return fmt.Errorf("%s: %v", os.Args[0], err)
|
||||
}
|
||||
}
|
||||
if cap != nil {
|
||||
|
|
|
|||
Loading…
Reference in New Issue