NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Some bug in libc/gen/fstab.c



On Fri, 15 Oct 2021, Rhialto wrote:

Searching in some plausible packages, I find
glib-2.68.4/gio/gunixmounts.c which used getfsent() but is a maze of
#ifdefs. But at first sight I see nothing obviously wrong with it.
It uses setfsent(), a loop on getfsent() and then endfsent().


Can you either

a) temporarily convert all NAME=... to actual device names in /etc/fstab, or

b) try the patch below. It's not a full patch--the configure bits are missing
   so you'll have to `#define HAVE_GETFSSPECNAME 1' to get it to compile.

---START PATCH---
diff -urN glib-main.orig/gio/gunixmounts.c glib-main/gio/gunixmounts.c
--- glib-main.orig/gio/gunixmounts.c	2021-10-13 08:49:06.000000000 +0000
+++ glib-main/gio/gunixmounts.c	2021-10-16 05:17:40.965542840 +0000
@@ -1473,7 +1473,14 @@
 	}
 #endif

-      mount_point = create_unix_mount_point (fstab->fs_spec,
+      char *spec = fstab->fs_spec;
+#ifdef HAVE_GETFSSPECNAME       /* NetBSD >= 7.0 */
+#include <util.h>
+      char buf[1024];
+      if (getfsspecname(buf, sizeof buf, spec) != NULL)
+        spec = buf;             /* must be superuser for call to succeed */
+#endif
+      mount_point = create_unix_mount_point (spec,
                                              fstab->fs_file,
                                              fstab->fs_vfstype,
                                              fstab->fs_mntops,
---END PATCH---

-RVP


Home | Main Index | Thread Index | Old Index