efreet: don't try change permissions on runtime dir we don't own.
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>
Mon, 24 Jun 2013 03:00:30 +0000 (12:00 +0900)
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>
Mon, 24 Jun 2013 03:00:30 +0000 (12:00 +0900)
src/lib/efreet/efreet_base.c

index 26346e0..93e264c 100644 (file)
@@ -335,13 +335,16 @@ efreet_dirs_init(void)
     }
     else if ((st.st_mode & 0777) != 0700)
     {
-        ERR("XDG_RUNTIME_DIR=%s is mode %o, changing to 0700",
-            xdg_runtime_dir, st.st_mode & 0777);
-        if (chmod(xdg_runtime_dir, 0700) != 0)
+        if (st.st_uid == geteuid())
         {
-            CRITICAL("Cannot fix XDG_RUNTIME_DIR=%s incorrect mode %o: %s",
-                     xdg_runtime_dir, st.st_mode & 0777, strerror(errno));
-            eina_stringshare_replace(&xdg_runtime_dir, NULL);
+            ERR("XDG_RUNTIME_DIR=%s is mode %o, changing to 0700",
+                xdg_runtime_dir, st.st_mode & 0777);
+            if (chmod(xdg_runtime_dir, 0700) != 0)
+            {
+                CRITICAL("Cannot fix XDG_RUNTIME_DIR=%s incorrect mode %o: %s",
+                         xdg_runtime_dir, st.st_mode & 0777, strerror(errno));
+                eina_stringshare_replace(&xdg_runtime_dir, NULL);
+            }
         }
     }
     /* hostname */