From 8fd15ac228af050f3a4ba0fbce8de2c7918612e8 Mon Sep 17 00:00:00 2001 From: Farid Zakaria Date: Wed, 21 May 2025 10:05:23 -0700 Subject: [PATCH] Add canon for path --- src/libutil/file-system.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libutil/file-system.cc b/src/libutil/file-system.cc index 103fe11b8..0f86dd2b1 100644 --- a/src/libutil/file-system.cc +++ b/src/libutil/file-system.cc @@ -626,7 +626,8 @@ Path makeTempPath(const Path & root, const Path & suffix) { // start the counter at a random value to minimize issues with preexisting temp paths static std::atomic_uint_fast32_t counter(std::random_device{}()); - return fmt("%1%%2%-%3%-%4%", root, suffix, getpid(), counter.fetch_add(1, std::memory_order_relaxed)); + auto tmpRoot = canonPath(root.empty() ? defaultTempDir() : root, true); + return fmt("%1%/%2%-%3%-%4%", tmpRoot, suffix, getpid(), counter.fetch_add(1, std::memory_order_relaxed)); } void createSymlink(const Path & target, const Path & link)