glib r6873 - branches/glib-2-16/gio
- From: davidz svn gnome org
- To: svn-commits-list gnome org
- Subject: glib r6873 - branches/glib-2-16/gio
- Date: Mon, 28 Apr 2008 23:41:15 +0100 (BST)
Author: davidz
Date: Mon Apr 28 22:41:15 2008
New Revision: 6873
URL: http://svn.gnome.org/viewvc/glib?rev=6873&view=rev
Log:
2008-04-28 David Zeuthen <davidz redhat com>
* gunixmounts.c (g_unix_mount_guess_should_display): Avoid
displaying mounts in a subdirectory not accessible to the
user (#526320).
Modified:
branches/glib-2-16/gio/ChangeLog
branches/glib-2-16/gio/gunixmounts.c
Modified: branches/glib-2-16/gio/gunixmounts.c
==============================================================================
--- branches/glib-2-16/gio/gunixmounts.c (original)
+++ branches/glib-2-16/gio/gunixmounts.c Mon Apr 28 22:41:15 2008
@@ -44,6 +44,7 @@
#include <errno.h>
#include <string.h>
#include <signal.h>
+#include <gstdio.h>
#include "gunixmounts.h"
#include "gfile.h"
@@ -1877,8 +1878,24 @@
mount_path = mount_entry->mount_path;
if (mount_path != NULL)
{
- if (g_str_has_prefix (mount_path, "/media/"))
+ if (g_str_has_prefix (mount_path, "/media/")) {
+ char *path;
+ /* 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.
+ */
+ path = g_path_get_dirname (mount_path);
+ if (g_str_has_prefix (path, "/media/"))
+ {
+ if (g_access (path, R_OK|X_OK) != 0) {
+ g_free (path);
+ return FALSE;
+ }
+ }
+ g_free (path);
return TRUE;
+ }
if (g_str_has_prefix (mount_path, g_get_home_dir ()) && mount_path[strlen (g_get_home_dir())] == G_DIR_SEPARATOR)
return TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]