summaryrefslogtreecommitdiff
path: root/devel/glib2/patches
diff options
context:
space:
mode:
authorwiz <wiz@pkgsrc.org>2021-09-18 13:19:26 +0000
committerwiz <wiz@pkgsrc.org>2021-09-18 13:19:26 +0000
commita2be3fe357f6595368da4356ac6e6e035c8404aa (patch)
tree074fca5366b55cb7f2b442ddff35a4127c0eb952 /devel/glib2/patches
parent1e45845d0d64a7fa40b1bf97c39f396c3f493594 (diff)
downloadpkgsrc-a2be3fe357f6595368da4356ac6e6e035c8404aa.tar.gz
glib2: getfsent() is not thread-safe.
Add patch from FreeBSD ports, via Sergio Lenzi in PR 56408. Bump PKGREVISION.
Diffstat (limited to 'devel/glib2/patches')
-rw-r--r--devel/glib2/patches/patch-gio_gunixmounts.c50
1 files changed, 47 insertions, 3 deletions
diff --git a/devel/glib2/patches/patch-gio_gunixmounts.c b/devel/glib2/patches/patch-gio_gunixmounts.c
index f43037d68c3..6608636de34 100644
--- a/devel/glib2/patches/patch-gio_gunixmounts.c
+++ b/devel/glib2/patches/patch-gio_gunixmounts.c
@@ -1,12 +1,17 @@
-$NetBSD: patch-gio_gunixmounts.c,v 1.5 2019/06/06 11:05:12 adam Exp $
+$NetBSD: patch-gio_gunixmounts.c,v 1.6 2021/09/18 13:19:26 wiz Exp $
SunOS has sys/mntent.h but no mnt_opts.
XXX who else uses the sys/mntent.h case?
https://gitlab.gnome.org/GNOME/glib/merge_requests/890
---- gio/gunixmounts.c.orig 2019-05-03 13:43:28.000000000 +0000
+getfsent does not support multiple threads, so use lock around its
+use.
+https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=250311
+https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1717
+
+--- gio/gunixmounts.c.orig 2021-08-19 15:27:25.722339900 +0000
+++ gio/gunixmounts.c
-@@ -736,7 +736,7 @@ _g_get_unix_mounts (void)
+@@ -743,7 +743,7 @@ _g_get_unix_mounts (void)
mntent.mnt_mountp,
NULL,
mntent.mnt_fstype,
@@ -15,3 +20,42 @@ https://gitlab.gnome.org/GNOME/glib/merge_requests/890
is_read_only);
return_list = g_list_prepend (return_list, mount_entry);
+@@ -1406,6 +1406,8 @@ _g_get_unix_mount_points (void)
+
+ #elif (defined(HAVE_GETVFSSTAT) || defined(HAVE_GETFSSTAT)) && defined(HAVE_FSTAB_H) && defined(HAVE_SYS_MOUNT_H)
+
++G_LOCK_DEFINE_STATIC(getfsent);
++
+ static GList *
+ _g_get_unix_mount_points (void)
+ {
+@@ -1417,9 +1419,6 @@ _g_get_unix_mount_points (void)
+ struct stat sb;
+ #endif
+
+- if (!setfsent ())
+- return NULL;
+-
+ return_list = NULL;
+
+ #ifdef HAVE_SYS_SYSCTL_H
+@@ -1450,6 +1449,11 @@ _g_get_unix_mount_points (void)
+ #endif
+ #endif
+
++ G_LOCK (getfsent);
++ if (!setfsent ()) {
++ G_UNLOCK (getfsent);
++ return NULL;
++ }
+ while ((fstab = getfsent ()) != NULL)
+ {
+ gboolean is_read_only = FALSE;
+@@ -1485,6 +1489,7 @@ _g_get_unix_mount_points (void)
+ }
+
+ endfsent ();
++ G_UNLOCK (getfsent);
+
+ return g_list_reverse (return_list);
+ }