glib r7733 - trunk/gio



Author: matthiasc
Date: Mon Dec  8 04:33:41 2008
New Revision: 7733
URL: http://svn.gnome.org/viewvc/glib?rev=7733&view=rev

Log:
       * gunixmounts.c: Use g_access() to check accessibility of local devices.
        Patch by Martin Pitt



Modified:
   trunk/gio/ChangeLog
   trunk/gio/gunixmounts.c

Modified: trunk/gio/gunixmounts.c
==============================================================================
--- trunk/gio/gunixmounts.c	(original)
+++ trunk/gio/gunixmounts.c	Mon Dec  8 04:33:41 2008
@@ -1882,7 +1882,8 @@
         /* Avoid displaying mounts that are not accessible to the user.
          *
          * See http://bugzilla.gnome.org/show_bug.cgi?id=526320 for why we
-         * want to avoid g_access() for every mount point.
+         * want to avoid g_access() for mount points which can potentially
+         * block or fail stat()'ing, such as network mounts.
          */
         path = g_path_get_dirname (mount_path);
         if (g_str_has_prefix (path, "/media/"))
@@ -1893,6 +1894,15 @@
             }
           }
         g_free (path);
+
+        if (mount_entry->device_path && mount_entry->device_path[0] == '/')
+           {
+             struct stat st;
+             if (g_stat (mount_entry->device_path, &st) == 0 &&
+                 S_ISBLK(st.st_mode) &&
+                 g_access (mount_path, R_OK|X_OK) != 0)
+               return FALSE;
+           }
         return TRUE;
       }
       



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]