efreet: Check return value of chmod
authorSebastian Dransfeld <sebastian.dransfeld@sintef.no>
Wed, 7 Aug 2013 08:52:48 +0000 (10:52 +0200)
committerSebastian Dransfeld <sebastian.dransfeld@sintef.no>
Wed, 7 Aug 2013 11:02:53 +0000 (13:02 +0200)
CID: #1039690

src/lib/efreet/efreet_base.c

index 7a13982..7c68751 100644 (file)
@@ -321,7 +321,14 @@ efreet_dirs_init(void)
         ERR("$XDG_RUNTIME_DIR did not exist, creating '%s' (breaks spec)",
             xdg_runtime_dir);
         if (ecore_file_mkpath(xdg_runtime_dir))
-            chmod(xdg_runtime_dir, 0700);
+        {
+            if (chmod(xdg_runtime_dir, 0700) < 0)
+            {
+                CRITICAL("Cannot set XDG_RUNTIME_DIR=%s to mode 0700: %s",
+                         xdg_runtime_dir, strerror(errno));
+                eina_stringshare_replace(&xdg_runtime_dir, NULL);
+            }
+        }
         else
         {
             CRITICAL("Failed to create XDG_RUNTIME_DIR=%s", xdg_runtime_dir);