mirror of https://github.com/containers/podman.git
util: specify a not empty pause dir for root too
commit b3014c1c69 changed
GetRootlessRuntimeDir() to return an empty string for root, so that
its value is not exported as XDG_RUNTIME_DIR, and other programs like
crun can use a better default.
Now GetRootlessPauseProcessPidPath() uses homedir.GetRuntimeDir().
The homedir.GetRuntimeDir() function returns a value also when running
as root so it can be used inside a nested Podman.
Closes: https://github.com/containers/podman/issues/22327
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
parent
6ec2c0b43b
commit
419efb9eb5
|
|
@ -28,7 +28,7 @@ func GetRootlessConfigHomeDir() (string, error) {
|
||||||
// GetRootlessPauseProcessPidPath returns the path to the file that holds the pid for
|
// GetRootlessPauseProcessPidPath returns the path to the file that holds the pid for
|
||||||
// the pause process.
|
// the pause process.
|
||||||
func GetRootlessPauseProcessPidPath() (string, error) {
|
func GetRootlessPauseProcessPidPath() (string, error) {
|
||||||
runtimeDir, err := GetRootlessRuntimeDir()
|
runtimeDir, err := homedir.GetRuntimeDir()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -764,3 +764,9 @@ func TestProcessOptions(t *testing.T) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestGetRootlessPauseProcessPidPath(t *testing.T) {
|
||||||
|
dir, err := GetRootlessPauseProcessPidPath()
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.NotEqual(t, dir, "libpod/tmp/pause.pid")
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue