mirror of
https://github.com/containers/podman.git
synced 2025-06-05 22:31:06 +08:00
Merge pull request #5237 from giuseppe/check-for-valid-conmon-process
rootless: check if the conmon process is valid
This commit is contained in:
@ -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 {
|
||||
@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user