]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
fix: Do not create /run directory on systems that don't have it (#1221)
authorOleg Sidorkin <osidorkin@gmail.com>
Sun, 13 Nov 2022 15:34:30 +0000 (18:34 +0300)
committerGitHub <noreply@github.com>
Sun, 13 Nov 2022 15:34:30 +0000 (16:34 +0100)
src/Config.cpp

index 275cdcb29178ba4f1595e9f6270284526d4e151d..5755c1b65f0e2d557293c3a3f10c9ffb9690fdfa 100644 (file)
@@ -1115,9 +1115,11 @@ Config::default_temporary_dir() const
 {
   static const std::string run_user_tmp_dir = [] {
 #ifdef HAVE_GETEUID
-    auto dir = FMT("/run/user/{}/ccache-tmp", geteuid());
-    if (Util::create_dir(dir) && access(dir.c_str(), W_OK) == 0) {
-      return dir;
+    if (Stat::stat("/run").is_directory()) {
+      auto dir = FMT("/run/user/{}/ccache-tmp", geteuid());
+      if (Util::create_dir(dir) && access(dir.c_str(), W_OK) == 0) {
+        return dir;
+      }
     }
 #endif
     return std::string();