Merge pull request #41293 from thaJeztah/19.03_backport_fix_getexecuser

[19.03 backport] oci: correctly use user.GetExecUser interface
This commit is contained in:
Tianon Gravi 2020-09-25 18:35:14 -07:00 committed by GitHub
commit 88623e101c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -157,7 +157,14 @@ func readUserFile(c *container.Container, p string) (io.ReadCloser, error) {
if err != nil {
return nil, err
}
return os.Open(fp)
fh, err := os.Open(fp)
if err != nil {
// This is needed because a nil *os.File is different to a nil
// io.ReadCloser and this causes GetExecUser to not detect that the
// container file is missing.
return nil, err
}
return fh, nil
}
func getUser(c *container.Container, username string) (uint32, uint32, []uint32, error) {