englebass pushed a commit to branch master.

commit b1c97a0da41e9bc998b3d9cf5c724c297582068f
Author: Sebastian Dransfeld <[email protected]>
Date:   Thu Jun 20 13:27:20 2013 +0200

    efreet: Create a temp XDG_RUNTIME_DIR if not set
    
    Using /tmp as XDG_RUNTIME_DIR is pointless if we want it to be mode 0700
---
 src/lib/efreet/efreet_base.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/lib/efreet/efreet_base.c b/src/lib/efreet/efreet_base.c
index 22217ba..26346e0 100644
--- a/src/lib/efreet/efreet_base.c
+++ b/src/lib/efreet/efreet_base.c
@@ -303,7 +303,19 @@ efreet_dirs_init(void)
     xdg_config_dirs = efreet_dirs_get("XDG_CONFIG_DIRS", "/etc/xdg");
 
     /* xdg_runtime_dir */
-    xdg_runtime_dir = efreet_dir_get("XDG_RUNTIME_DIR", "/tmp");
+    xdg_runtime_dir = getenv("XDG_RUNTIME_DIR");
+    if (!xdg_runtime_dir)
+    {
+        snprintf(buf, sizeof(buf), "/tmp/xdg-XXXXXX");
+        xdg_runtime_dir = mkdtemp(buf);
+        if (!xdg_runtime_dir)
+        {
+            perror("efreet mkdtemp");
+            xdg_runtime_dir = "/tmp";
+        }
+    }
+    xdg_runtime_dir = eina_stringshare_add(xdg_runtime_dir);
+
     if (stat(xdg_runtime_dir, &st) == -1)
     {
         ERR("$XDG_RUNTIME_DIR did not exist, creating '%s' (breaks spec)",

-- 

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev

Reply via email to