From 3b82cc55dea66c9c404c73b010203fd6a2c38cdb Mon Sep 17 00:00:00 2001 From: Ophestra Umiker Date: Fri, 25 Oct 2024 12:14:57 +0900 Subject: [PATCH] internal: use fallback paths when XDG_RUNTIME_DIR is not absolute There are scenarios where XDG_RUNTIME_DIR is set to an empty string or garbage. This check tries to ensure reasonable behaviour in most of those cases. Signed-off-by: Ophestra Umiker --- internal/system.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/system.go b/internal/system.go index 6467ea0..5f5e76b 100644 --- a/internal/system.go +++ b/internal/system.go @@ -55,7 +55,7 @@ func CopyPaths(os System, v *Paths) { fmsg.VPrintf("process share directory at %q", v.SharePath) - if r, ok := os.LookupEnv(xdgRuntimeDir); !ok { + if r, ok := os.LookupEnv(xdgRuntimeDir); !ok || r == "" || !path.IsAbs(r) { // fall back to path in share since fortify has no hard XDG dependency v.RunDirPath = path.Join(v.SharePath, "run") v.RuntimePath = path.Join(v.RunDirPath, "compat")