Skip to content
This repository was archived by the owner on Oct 13, 2023. It is now read-only.

Commit 3a9689e

Browse files
authored
Merge pull request #41293 from thaJeztah/19.03_backport_fix_getexecuser
[19.03 backport] oci: correctly use user.GetExecUser interface Upstream-commit: 88623e101cbcbacce553b40ed0a5734171227151 Component: engine
2 parents a4e29bd + 3f7bf34 commit 3a9689e

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

components/engine/daemon/oci_linux.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,14 @@ func readUserFile(c *container.Container, p string) (io.ReadCloser, error) {
157157
if err != nil {
158158
return nil, err
159159
}
160-
return os.Open(fp)
160+
fh, err := os.Open(fp)
161+
if err != nil {
162+
// This is needed because a nil *os.File is different to a nil
163+
// io.ReadCloser and this causes GetExecUser to not detect that the
164+
// container file is missing.
165+
return nil, err
166+
}
167+
return fh, nil
161168
}
162169

163170
func getUser(c *container.Container, username string) (uint32, uint32, []uint32, error) {

0 commit comments

Comments
 (0)