From 32ab7472f3e535c3317e6522205abe64e2864227 Mon Sep 17 00:00:00 2001 From: apostasie <spam_blackhole@farcloser.world> Date: Mon, 2 Dec 2024 21:43:21 -0800 Subject: [PATCH] Create directory for bypass4netns pid file Signed-off-by: apostasie <spam_blackhole@farcloser.world> --- pkg/bypass4netnsutil/bypass4netnsutil.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pkg/bypass4netnsutil/bypass4netnsutil.go b/pkg/bypass4netnsutil/bypass4netnsutil.go index 7fa7e605a72..b34f1e4c08f 100644 --- a/pkg/bypass4netnsutil/bypass4netnsutil.go +++ b/pkg/bypass4netnsutil/bypass4netnsutil.go @@ -131,8 +131,14 @@ func GetPidFilePathByID(id string) (string, error) { return "", err } - socketPath := filepath.Join(xdgRuntimeDir, "bypass4netns", id[0:15]+".pid") - return socketPath, nil + pidPath := filepath.Join(xdgRuntimeDir, "bypass4netns", id[0:15]+".pid") + + err = os.MkdirAll(filepath.Join(xdgRuntimeDir, "bypass4netns"), 0o700) + if err != nil { + return "", err + } + + return pidPath, nil } func IsBypass4netnsEnabled(annotationsMap map[string]string) (enabled, bindEnabled bool, err error) {