Skip to content

Commit

Permalink
Merge pull request #7292 from spearlineltd/cleanupzombie
Browse files Browse the repository at this point in the history
Wait for reexec to finish when fileOutput is nil
  • Loading branch information
openshift-merge-robot authored Aug 18, 2020
2 parents 8caed30 + 0cd2f2d commit 49d6468
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/rootless/rootless_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,11 @@ func becomeRootInUserNS(pausePid, fileToRead string, fileOutput *os.File) (_ boo
if pid < 0 {
return false, -1, errors.Errorf("cannot re-exec process")
}
defer func() {
if retErr != nil {
C.reexec_in_user_namespace_wait(pidC, 0)
}
}()

uids, gids, err := GetConfiguredMappings()
if err != nil {
Expand Down Expand Up @@ -294,6 +299,11 @@ func becomeRootInUserNS(pausePid, fileToRead string, fileOutput *os.File) (_ boo
}

if fileOutput != nil {
ret := C.reexec_in_user_namespace_wait(pidC, 0)
if ret < 0 {
return false, -1, errors.New("error waiting for the re-exec process")
}

return true, 0, nil
}

Expand Down

0 comments on commit 49d6468

Please sign in to comment.