mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-23 02:32:11 +01:00
[PATCH] Add lock in _g_get_unix_mount_points() around *fsent() functions
(cherry-picked from commit f43cf341511dd684a58c09e104e28c11987cbff1)
This commit is contained in:
parent
d1766e99e5
commit
07b062b4dc
@ -1408,17 +1408,13 @@ _g_get_unix_mount_points (void)
|
||||
{
|
||||
struct fstab *fstab = NULL;
|
||||
GUnixMountPoint *mount_point;
|
||||
GList *return_list;
|
||||
GList *return_list = NULL;
|
||||
G_LOCK_DEFINE_STATIC (fsent);
|
||||
#ifdef HAVE_SYS_SYSCTL_H
|
||||
int usermnt = 0;
|
||||
struct stat sb;
|
||||
#endif
|
||||
|
||||
if (!setfsent ())
|
||||
return NULL;
|
||||
|
||||
return_list = NULL;
|
||||
|
||||
#ifdef HAVE_SYS_SYSCTL_H
|
||||
#if defined(HAVE_SYSCTLBYNAME)
|
||||
{
|
||||
@ -1447,6 +1443,13 @@ _g_get_unix_mount_points (void)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
G_LOCK (fsent);
|
||||
if (!setfsent ())
|
||||
{
|
||||
G_UNLOCK (fsent);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
while ((fstab = getfsent ()) != NULL)
|
||||
{
|
||||
gboolean is_read_only = FALSE;
|
||||
@ -1482,6 +1485,7 @@ _g_get_unix_mount_points (void)
|
||||
}
|
||||
|
||||
endfsent ();
|
||||
G_UNLOCK (fsent);
|
||||
|
||||
return g_list_reverse (return_list);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user