[Bug 250311] devel/glib20: lock getfsent() usage to fix x11-fm/thunar crashes

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Thu Oct 15 17:16:15 UTC 2020


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=250311

--- Comment #3 from sigsys at gmail.com ---
(In reply to Tijl Coosemans from comment #2)
Oops you're right.

Better to move the call down while at it? No need to protect the sysctls.

--- gio/gunixmounts.c.orig      2020-10-01 09:17:53.138733000 -0400
+++ gio/gunixmounts.c   2020-10-15 13:05:40.628175000 -0400
@@ -1389,6 +1389,8 @@

 #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)
 {
@@ -1400,9 +1402,6 @@
   struct stat sb;
 #endif

-  if (!setfsent ())
-    return NULL;
-
   return_list = NULL;

 #ifdef HAVE_SYS_SYSCTL_H
@@ -1433,6 +1432,11 @@
 #endif
 #endif

+  G_LOCK (getfsent);
+  if (!setfsent ()) {
+    G_UNLOCK (getfsent);
+    return NULL;
+  }
   while ((fstab = getfsent ()) != NULL)
     {
       gboolean is_read_only = FALSE;
@@ -1468,6 +1472,7 @@
     }

   endfsent ();
+  G_UNLOCK (getfsent);

   return g_list_reverse (return_list);
 }

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the freebsd-xfce mailing list