e: Create a temp XDG_RUNTIME_DIR if not set
authorSebastian Dransfeld <sd@tango.flipp.net>
Thu, 20 Jun 2013 11:29:37 +0000 (13:29 +0200)
committerSebastian Dransfeld <sd@tango.flipp.net>
Thu, 20 Jun 2013 11:29:37 +0000 (13:29 +0200)
Using /tmp as XDG_RUNTIME_DIR is pointless if we want it to be mode 0700

src/bin/e_main.c

index 5a10ffa..fd81bc6 100644 (file)
@@ -151,7 +151,15 @@ _xdg_data_dirs_augment(void)
      }
 
    if (!getenv("XDG_RUNTIME_DIR"))
-     e_util_env_set("XDG_RUNTIME_DIR", "/tmp");
+     {
+        char        buf[PATH_MAX];
+        const char *dir;
+
+        snprintf(buf, sizeof(buf), "/tmp/xdg_runtime_XXXXXX");
+        dir = mkdtemp(buf);
+        if (!dir) dir = "/tmp";
+        e_util_env_set("XDG_RUNTIME_DIR", dir);
+     }
 }
 
 static void