[PATCH] Add lock in _g_get_unix_mount_points() around *fsent() functions

This commit is contained in:
Rozhuk Ivan 2022-06-25 18:46:08 +03:00
parent 99a7c6351c
commit f43cf34151

View File

@ -1410,17 +1410,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)
{
@ -1449,6 +1445,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;
@ -1484,6 +1487,7 @@ _g_get_unix_mount_points (void)
}
endfsent ();
G_UNLOCK (fsent);
return g_list_reverse (return_list);
}