diff options
Diffstat (limited to 'sysutils/gnome-mount/files/patch-src_gnome-mount.c')
-rw-r--r-- | sysutils/gnome-mount/files/patch-src_gnome-mount.c | 131 |
1 files changed, 110 insertions, 21 deletions
diff --git a/sysutils/gnome-mount/files/patch-src_gnome-mount.c b/sysutils/gnome-mount/files/patch-src_gnome-mount.c index eb78bab377f5..19de73ccd87b 100644 --- a/sysutils/gnome-mount/files/patch-src_gnome-mount.c +++ b/sysutils/gnome-mount/files/patch-src_gnome-mount.c @@ -1,29 +1,118 @@ ---- src/gnome-mount.c.orig Mon Sep 4 21:41:09 2006 -+++ src/gnome-mount.c Mon Sep 4 21:45:53 2006 -@@ -42,7 +42,7 @@ +--- src/gnome-mount.c.orig Sun Sep 17 01:17:54 2006 ++++ src/gnome-mount.c Sun Feb 11 01:03:16 2007 +@@ -51,9 +51,14 @@ #include <libhal.h> #include <libhal-storage.h> --#include <mntent.h> -+#include "mntent.h" +-#ifndef sun ++#if !defined(sun) && !defined(__FreeBSD__) + #include <mntent.h> +-#else ++#elif defined(__FreeBSD__) ++#include <fstab.h> ++#include <sys/param.h> ++#include <sys/ucred.h> ++#include <sys/mount.h> ++#elif defined(sun) + #include <sys/mnttab.h> + #endif - static DBusConnection *dbus_connection; - static LibHalContext *hal_ctx; -@@ -477,7 +477,7 @@ +@@ -380,7 +385,7 @@ show_error_dialog_mount (LibHalVolume *v + } else if (strcmp (error_name, "org.freedesktop.Hal.Device.Volume.AlreadyMounted") == 0) { - mount_point = NULL; - device_file = get_dev_file (volume, drive); -- -+#ifdef __linux__ - if (device_file != NULL) { - FILE *f; - struct mntent mnt; -@@ -497,7 +497,7 @@ - endmntent (f); - } + /* don't show any dialog for this */ +- gtk_widget_unref (w); ++ gtk_widget_destroy (w); + w = NULL; + + #if 0 +@@ -399,7 +404,7 @@ show_error_dialog_mount (LibHalVolume *v + * + * Don't show any dialog for this. + */ +- gtk_widget_unref (w); ++ gtk_widget_destroy (w); + w = NULL; + + } else { +@@ -582,19 +587,24 @@ static char * + get_mntent_mount_point(const char *device_file) + { + char *mount_point; ++#if! defined(sun) && !defined(__FreeBSD__) + FILE *f; +-#ifndef sun + struct mntent mnt; + struct mntent *mnte; + char buf[512]; +-#else ++#elif defined(__FreeBSD__) ++ struct statfs *mounts; ++ int n_mounts; ++ int i; ++#elif defined(sun) ++ FILE *f; + struct mnttab mnt; + struct mnttab mpref = { NULL, NULL, NULL, NULL, NULL }; + #endif + + mount_point = NULL; + +-#ifndef sun ++#if !defined(sun) && !defined(__FreeBSD__) + if ((f = setmntent ("/proc/mounts", "r")) != NULL) { + + while ((mnte = getmntent_r (f, &mnt, buf, sizeof(buf))) != NULL) { +@@ -608,7 +618,7 @@ get_mntent_mount_point(const char *devic + endmntent (f); + } + +-#else /* sun */ ++#elif defined(sun) /* sun */ + + if ((f = fopen(MNTTAB, "r")) != NULL) { + mpref.mnt_special = (char *)device_file; +@@ -617,8 +627,13 @@ get_mntent_mount_point(const char *devic } + fclose(f); + } - +-#endif /* sun */ ++#elif defined(__FreeBSD__) ++ n_mounts = getmntinfo(&mounts, MNT_NOWAIT); ++ for (i = 0; i < n_mounts; i++) { ++ if (!strcmp(mounts[i].f_mntfromname, device_file)) ++ mount_point = g_strdup (mounts[i].f_mntonname); ++ } ++#endif /* sun && __FreeBSD__ */ + + out: + return (mount_point); +@@ -1322,7 +1337,11 @@ volume_mount (const char *udi, LibHalVol + if (volume == NULL && (mount_options->len == 0)) { + /* volume from a non-pollable drive, just set uid.. */ + ++#ifndef __FreeBSD__ + snprintf (uidbuf, sizeof (uidbuf) - 1, "uid=%u", getuid ()); ++#else ++ snprintf (uidbuf, sizeof (uidbuf) - 1, "-u=%u", getuid ()); +#endif - g_print (_("Mounted %s at \"%s\"\n"), device_file, mount_point); - g_free (mount_point); - } + g_ptr_array_add (mount_options, uidbuf); + + } else if (((fstype_override != NULL) || (fstype != NULL)) && (mount_options->len == 0)) { +@@ -1349,9 +1368,15 @@ volume_mount (const char *udi, LibHalVol + g_debug ("read default option '%s' from gconf strlist key %s", option, key); + + /* special workaround to replace "uid=" with "uid=<actual uid of caller>" */ ++#ifndef __FreeBSD__ + if (strcmp (option, "uid=") == 0) { + g_free (option); + option = g_strdup_printf ("uid=%u", getuid ()); ++#else ++ if (strcmp (option, "-u=") == 0) { ++ g_free (option); ++ option = g_strdup_printf ("-u=%u", getuid ()); ++#endif + } + g_ptr_array_add (mount_options, option); + |