Skip to content

Commit

Permalink
Merge pull request #5237 from giuseppe/check-for-valid-conmon-process
Browse files Browse the repository at this point in the history
rootless: check if the conmon process is valid
  • Loading branch information
openshift-merge-robot authored Feb 17, 2020
2 parents 640b11f + e9dc212 commit 0bd29f8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/rootless/rootless_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,7 @@ func TryJoinFromFilePaths(pausePidPath string, needNewNamespace bool, paths []st

var lastErr error
var pausePid int
foundProcess := false

for _, path := range paths {
if !needNewNamespace {
Expand Down Expand Up @@ -502,12 +503,16 @@ func TryJoinFromFilePaths(pausePidPath string, needNewNamespace bool, paths []st
}

pausePid, err = strconv.Atoi(string(b[:n]))
if err == nil {
if err == nil && unix.Kill(pausePid, 0) == nil {
foundProcess = true
lastErr = nil
break
}
}
}
if !foundProcess {
return BecomeRootInUserNS(pausePidPath)
}
if lastErr != nil {
return false, 0, lastErr
}
Expand Down

0 comments on commit 0bd29f8

Please sign in to comment.