mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-11 11:56:16 +01:00
Merge branch 'getfsent_lock2' into 'main'
_g_get_unix_mount_points(): reduce syscalls inside loop See merge request GNOME/glib!2783
This commit is contained in:
commit
3c47fa6e20
@ -1412,6 +1412,7 @@ _g_get_unix_mount_points (void)
|
|||||||
GUnixMountPoint *mount_point;
|
GUnixMountPoint *mount_point;
|
||||||
GList *return_list;
|
GList *return_list;
|
||||||
#ifdef HAVE_SYS_SYSCTL_H
|
#ifdef HAVE_SYS_SYSCTL_H
|
||||||
|
uid_t uid = getuid ();
|
||||||
int usermnt = 0;
|
int usermnt = 0;
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
#endif
|
#endif
|
||||||
@ -1462,14 +1463,13 @@ _g_get_unix_mount_points (void)
|
|||||||
|
|
||||||
#ifdef HAVE_SYS_SYSCTL_H
|
#ifdef HAVE_SYS_SYSCTL_H
|
||||||
if (usermnt != 0)
|
if (usermnt != 0)
|
||||||
{
|
{
|
||||||
uid_t uid = getuid ();
|
if (uid == 0 ||
|
||||||
if (stat (fstab->fs_file, &sb) == 0)
|
(stat (fstab->fs_file, &sb) == 0 && sb.st_uid == uid))
|
||||||
{
|
{
|
||||||
if (uid == 0 || sb.st_uid == uid)
|
is_user_mountable = TRUE;
|
||||||
is_user_mountable = TRUE;
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
mount_point = create_unix_mount_point (fstab->fs_spec,
|
mount_point = create_unix_mount_point (fstab->fs_spec,
|
||||||
|
Loading…
Reference in New Issue
Block a user