mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-23 20:46:14 +01:00
Merge branch 'getfsent_lock' into 'main'
Add lock in _g_get_unix_mount_points() around *fsent() functions See merge request GNOME/glib!1717
This commit is contained in:
commit
6d381c9668
@ -1410,18 +1410,14 @@ _g_get_unix_mount_points (void)
|
|||||||
{
|
{
|
||||||
struct fstab *fstab = NULL;
|
struct fstab *fstab = NULL;
|
||||||
GUnixMountPoint *mount_point;
|
GUnixMountPoint *mount_point;
|
||||||
GList *return_list;
|
GList *return_list = NULL;
|
||||||
|
G_LOCK_DEFINE_STATIC (fsent);
|
||||||
#ifdef HAVE_SYS_SYSCTL_H
|
#ifdef HAVE_SYS_SYSCTL_H
|
||||||
uid_t uid = getuid ();
|
uid_t uid = getuid ();
|
||||||
int usermnt = 0;
|
int usermnt = 0;
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!setfsent ())
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
return_list = NULL;
|
|
||||||
|
|
||||||
#ifdef HAVE_SYS_SYSCTL_H
|
#ifdef HAVE_SYS_SYSCTL_H
|
||||||
#if defined(HAVE_SYSCTLBYNAME)
|
#if defined(HAVE_SYSCTLBYNAME)
|
||||||
{
|
{
|
||||||
@ -1449,7 +1445,14 @@ _g_get_unix_mount_points (void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
G_LOCK (fsent);
|
||||||
|
if (!setfsent ())
|
||||||
|
{
|
||||||
|
G_UNLOCK (fsent);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
while ((fstab = getfsent ()) != NULL)
|
while ((fstab = getfsent ()) != NULL)
|
||||||
{
|
{
|
||||||
gboolean is_read_only = FALSE;
|
gboolean is_read_only = FALSE;
|
||||||
@ -1482,9 +1485,10 @@ _g_get_unix_mount_points (void)
|
|||||||
|
|
||||||
return_list = g_list_prepend (return_list, mount_point);
|
return_list = g_list_prepend (return_list, mount_point);
|
||||||
}
|
}
|
||||||
|
|
||||||
endfsent ();
|
endfsent ();
|
||||||
|
G_UNLOCK (fsent);
|
||||||
|
|
||||||
return g_list_reverse (return_list);
|
return g_list_reverse (return_list);
|
||||||
}
|
}
|
||||||
/* Interix {{{2 */
|
/* Interix {{{2 */
|
||||||
|
Loading…
Reference in New Issue
Block a user