freebsd-ports/sysutils/hal/files/patch-tools_hal-storage-mount.c
Joe Marcus Clarke 610ae56816 Presenting GNOME 2.24 for FreeBSD.
See http://library.gnome.org/misc/release-notes/2.24/ for the general
release notes.  On the FreeBSD front, this release introduces Fuse support
in HAL, adds multi-CPU support to libgtop, WebKit updates, and fixes some
long-standing seahorse and gnome-keyring bugs.  The documentation updates
to the website are forthcoming.

This release features commits by adamw, ahze, kwm, mezz, and myself.  It would
not have been possible without are contributors and testers:

Alexander Loginov
Craig Butler [1]
Dmitry Marakasov [6]
Eric L. Chen
Joseph S. Atkinson
Kris Moore
Lapo Luchini [7]
Nikos Ntarmos
Pawel Worach
Romain Tartiere
TAOKA Fumiyoshi [3]
Yasuda Keisuke
Zyl
aZ [4]
bf [2] [5]
Florent Thoumie
Peter Wemm
pluknet

PR:		125857 [1]
		126993 [2]
		130031 [3]
		127399 [4]
		127661 [5]
		124302 [6]
		129570 [7]
		129936
		123790
2009-01-10 05:22:13 +00:00

91 lines
2.3 KiB
C

--- tools/hal-storage-mount.c.orig 2008-05-07 19:24:23.000000000 -0400
+++ tools/hal-storage-mount.c 2008-10-09 00:54:34.000000000 -0400
@@ -56,8 +56,9 @@
#ifdef __FreeBSD__
#define MOUNT "/sbin/mount"
-#define MOUNT_OPTIONS "noexec,nosuid"
+#define MOUNT_OPTIONS "nosuid"
#define MOUNT_TYPE_OPT "-t"
+#define FUSE_DB "/tmp/.fuse-mnts"
#elif sun
#define MOUNT "/sbin/mount"
#define MOUNT_OPTIONS "noexec,nosuid"
@@ -255,6 +256,51 @@ out:
return f;
}
+#ifdef __FreeBSD__
+static char *
+resolve_fuse (const char *special)
+{
+ gchar *contents;
+ gchar **lines;
+ gsize len;
+ int i;
+
+ if (! g_file_get_contents (FUSE_DB, &contents, &len, NULL))
+ return g_strdup (special);
+
+ lines = g_strsplit (contents, "\n", 0);
+ g_free (contents);
+
+ for (i = 0; lines && lines[i]; i++) {
+ gchar **fields;
+
+ fields = g_strsplit (lines[i], "=", 2);
+ if (fields && g_strv_length (fields) == 2) {
+ if (strcmp (fields[0], special) == 0) {
+ g_strfreev (fields);
+ g_strfreev (lines);
+ return g_strdup (fields[1]);
+ }
+ }
+ g_strfreev (fields);
+ }
+
+ g_strfreev (lines);
+
+ return g_strdup (special);
+}
+#endif
+
+static char *
+resolve_special (const char *special)
+{
+#ifdef __FreeBSD__
+ if (strstr(special, "fuse"))
+ return resolve_fuse (special);
+#endif
+ return g_strdup (special);
+}
+
static LibHalVolume *
volume_findby (LibHalContext *hal_ctx, const char *property, const char *value)
{
@@ -400,18 +446,20 @@ device_is_mounted (const char *device, c
unknown_error ("Cannot open /etc/mtab or equivalent");
}
while (((entry = mtab_next (handle, mount_point)) != NULL) && (ret == FALSE)) {
- char *resolved;
+ char *resolved, *rspecial;
resolved = resolve_symlink (entry);
+ rspecial = resolve_special (resolved);
+ g_free (resolved);
#ifdef DEBUG
- printf ("/proc/mounts: device %s -> %s \n", entry, resolved);
+ printf ("/proc/mounts: device %s -> %s \n", entry, rspecial);
#endif
- if (strcmp (device, resolved) == 0) {
- printf ("%s (-> %s) found in mount list. Not mounting.\n", entry, resolved);
+ if (strcmp (device, rspecial) == 0) {
+ printf ("%s (-> %s) found in mount list. Not mounting.\n", entry, rspecial);
ret = TRUE;
}
- g_free (resolved);
+ g_free (rspecial);
}
mtab_close (handle);
return ret;