mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-12 15:36:17 +01:00
Use g_access() to check accessibility of local devices. Patch by Martin
* gunixmounts.c: Use g_access() to check accessibility of local devices. Patch by Martin Pitt svn path=/trunk/; revision=7733
This commit is contained in:
parent
154fe24134
commit
08b1ec389b
@ -1,3 +1,11 @@
|
||||
2008-12-07 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
Bug 526320 – should not list mounts that the user doesn't have
|
||||
permission to use
|
||||
|
||||
gunixmounts.c: Use g_access() to check accessibility of local devices.
|
||||
Patch by Martin Pitt
|
||||
|
||||
2008-12-01 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* === Released 2.19.2 ===
|
||||
|
@ -1882,7 +1882,8 @@ g_unix_mount_guess_should_display (GUnixMountEntry *mount_entry)
|
||||
/* 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_unix_mount_guess_should_display (GUnixMountEntry *mount_entry)
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user