Skip to content

Commit

Permalink
Merge pull request #2896 from giuseppe/fix-segfault-reload
Browse files Browse the repository at this point in the history
rootless: fix segfault on refresh if there are containers
  • Loading branch information
openshift-merge-robot authored Apr 11, 2019
2 parents f9ae2d4 + 09532c8 commit 638789f
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions libpod/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -870,6 +870,20 @@ func makeRuntime(runtime *Runtime) (err error) {

_, err = os.Stat(runtimeAliveFile)
if err != nil {
// If we need to refresh, then it is safe to assume there are
// no containers running. Create immediately a namespace, as
// we will need to access the storage.
if os.Geteuid() != 0 {
aliveLock.Unlock()
became, ret, err := rootless.BecomeRootInUserNS()
if err != nil {
return err
}
if became {
os.Exit(ret)
}

}
// If the file doesn't exist, we need to refresh the state
// This will trigger on first use as well, but refreshing an
// empty state only creates a single file
Expand Down

0 comments on commit 638789f

Please sign in to comment.