Skip to content

Commit 419efb9

Browse files
committed
util: specify a not empty pause dir for root too
commit b3014c1 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: #22327 Signed-off-by: Giuseppe Scrivano <[email protected]>
1 parent 6ec2c0b commit 419efb9

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

pkg/util/utils_supported.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func GetRootlessConfigHomeDir() (string, error) {
2828
// GetRootlessPauseProcessPidPath returns the path to the file that holds the pid for
2929
// the pause process.
3030
func GetRootlessPauseProcessPidPath() (string, error) {
31-
runtimeDir, err := GetRootlessRuntimeDir()
31+
runtimeDir, err := homedir.GetRuntimeDir()
3232
if err != nil {
3333
return "", err
3434
}

pkg/util/utils_test.go

+6
Original file line numberDiff line numberDiff line change
@@ -764,3 +764,9 @@ func TestProcessOptions(t *testing.T) {
764764
})
765765
}
766766
}
767+
768+
func TestGetRootlessPauseProcessPidPath(t *testing.T) {
769+
dir, err := GetRootlessPauseProcessPidPath()
770+
assert.NoError(t, err)
771+
assert.NotEqual(t, dir, "libpod/tmp/pause.pid")
772+
}

0 commit comments

Comments
 (0)