drivers/platformLChown: return early

This is purely aesthetical -- in case we can't get struct stat_t,
return early. This improves readability and decreases the indentation.

No functional change. Please review this with --ignore-space-change.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
Kir Kolyshkin 2020-03-11 08:03:43 -07:00
parent e517250392
commit 1e8bf20d6b
1 changed files with 56 additions and 55 deletions

View File

@ -12,8 +12,10 @@ import (
) )
func platformLChown(path string, info os.FileInfo, toHost, toContainer *idtools.IDMappings) error { func platformLChown(path string, info os.FileInfo, toHost, toContainer *idtools.IDMappings) error {
sysinfo := info.Sys() st, ok := info.Sys().(*syscall.Stat_t)
if st, ok := sysinfo.(*syscall.Stat_t); ok { if !ok {
return nil
}
// Map an on-disk UID/GID pair from host to container // Map an on-disk UID/GID pair from host to container
// using the first map, then back to the host using the // using the first map, then back to the host using the
// second map. Skip that first step if they're 0, to // second map. Skip that first step if they're 0, to
@ -72,6 +74,5 @@ func platformLChown(path string, info os.FileInfo, toHost, toContainer *idtools.
} }
} }
}
return nil return nil
} }