------BEGIN PGP SIGNED MESSAGE-----
-Hash: SHA1
-
-AUX gnome-mount-0.4-fix-segv-on-no-media.patch 2028 RMD160 20a53ba84af5cd6434b702b80a6ed306820a5311 SHA1 a696b92642108e00bbc23f1e8cf6810961361f7b SHA256 1f55612af18786a7a9275765ab2c6bd4ea3f47654b6c5c890607833af0ff3197 size 2028
+AUX gnome-mount-0.4-fix-segv-on-no-media.patch 2028 RMD160 20a53ba84af5cd6434b702b80a6ed306820a5311 SHA1 a696b92642108e00bbc23f1e8cf6810961361f7b SHA256 1f55612af18786a7a9275765ab2c6bd4ea3f47654b6c5c890607833af0ff3197
MD5 513dc3798c037e4d3ddf19ec0fb2b8fe files/gnome-mount-0.4-fix-segv-on-no-media.patch 2028
RMD160 20a53ba84af5cd6434b702b80a6ed306820a5311 files/gnome-mount-0.4-fix-segv-on-no-media.patch 2028
SHA256 1f55612af18786a7a9275765ab2c6bd4ea3f47654b6c5c890607833af0ff3197 files/gnome-mount-0.4-fix-segv-on-no-media.patch 2028
-AUX gnome-mount-0.4-hal-mountable.patch 564 RMD160 e4cc5e3901738f0d15e51df2603586dbfa7c69b5 SHA1 91d5e00d8138be5a9be0b4585f8535e236b29f05 SHA256 889921c0867d0855d5b343a7e61b0c4a07202f81ce87cb5320842d68f875bd13 size 564
+AUX gnome-mount-0.4-hal-mountable.patch 564 RMD160 e4cc5e3901738f0d15e51df2603586dbfa7c69b5 SHA1 91d5e00d8138be5a9be0b4585f8535e236b29f05 SHA256 889921c0867d0855d5b343a7e61b0c4a07202f81ce87cb5320842d68f875bd13
MD5 cbbc2b9e3b351a389b877bbb0423e34b files/gnome-mount-0.4-hal-mountable.patch 564
RMD160 e4cc5e3901738f0d15e51df2603586dbfa7c69b5 files/gnome-mount-0.4-hal-mountable.patch 564
SHA256 889921c0867d0855d5b343a7e61b0c4a07202f81ce87cb5320842d68f875bd13 files/gnome-mount-0.4-hal-mountable.patch 564
-DIST gnome-mount-0.4.tar.gz 364546 RMD160 a4f28e3111bfcfce2101cbf53f9c57f63d9ba2be SHA256 fa9456c0cd1adeda962721fed955914bdc23723a403bebf31bd95a1f54211dd8 size 364546
-EBUILD gnome-mount-0.4-r2.ebuild 928 RMD160 f3e42debaf5ff8b50b9ef5ecd98c3e837a1d56b2 SHA1 4fc2ef3fd3cd2a149322cb060d81058e3a34a630 SHA256 ab3c526a7785d7cab7959950ef1a59f65b8ff5dc78f9c94754b511dfab4e3267 size 928
+AUX gnome-mount-hal-no-media-fstab.patch 15854 RMD160 53fc945ecca7fb7ba7a3805002e23b4abc160351 SHA1 23259c23fc95fe7c77671b9b69e88dacb2538b7e SHA256 49fe069d1fc5ebe16cb4f6929c457ae459056195f242891e20bb05e3b9fc91f8
+MD5 7a04f8633da7884e72aaf1016bc8ca96 files/gnome-mount-hal-no-media-fstab.patch 15854
+RMD160 53fc945ecca7fb7ba7a3805002e23b4abc160351 files/gnome-mount-hal-no-media-fstab.patch 15854
+SHA256 49fe069d1fc5ebe16cb4f6929c457ae459056195f242891e20bb05e3b9fc91f8 files/gnome-mount-hal-no-media-fstab.patch 15854
+DIST gnome-mount-0.4.tar.gz 364546 RMD160 a4f28e3111bfcfce2101cbf53f9c57f63d9ba2be SHA1 35df047b54a2dbbaa5e297396b880472679af085 SHA256 fa9456c0cd1adeda962721fed955914bdc23723a403bebf31bd95a1f54211dd8
+EBUILD gnome-mount-0.4-r2.ebuild 928 RMD160 f3e42debaf5ff8b50b9ef5ecd98c3e837a1d56b2 SHA1 4fc2ef3fd3cd2a149322cb060d81058e3a34a630 SHA256 ab3c526a7785d7cab7959950ef1a59f65b8ff5dc78f9c94754b511dfab4e3267
MD5 8bd044bdf0d00887e0e3da13fa6bf382 gnome-mount-0.4-r2.ebuild 928
RMD160 f3e42debaf5ff8b50b9ef5ecd98c3e837a1d56b2 gnome-mount-0.4-r2.ebuild 928
SHA256 ab3c526a7785d7cab7959950ef1a59f65b8ff5dc78f9c94754b511dfab4e3267 gnome-mount-0.4-r2.ebuild 928
-EBUILD gnome-mount-0.4-r3.ebuild 1006 RMD160 18fbfc9cb5ca2aebad3121c96977fc48ff37a2ec SHA1 5be9b2625575fdecb4b2302f532b0117eda88573 SHA256 c962d298d89b3b454eabe45d585f19ee05762c615178aa05123e6ec50a4ef6ee size 1006
+EBUILD gnome-mount-0.4-r3.ebuild 1006 RMD160 18fbfc9cb5ca2aebad3121c96977fc48ff37a2ec SHA1 5be9b2625575fdecb4b2302f532b0117eda88573 SHA256 c962d298d89b3b454eabe45d585f19ee05762c615178aa05123e6ec50a4ef6ee
MD5 e831f937604f12e534659b5a07a36b48 gnome-mount-0.4-r3.ebuild 1006
RMD160 18fbfc9cb5ca2aebad3121c96977fc48ff37a2ec gnome-mount-0.4-r3.ebuild 1006
SHA256 c962d298d89b3b454eabe45d585f19ee05762c615178aa05123e6ec50a4ef6ee gnome-mount-0.4-r3.ebuild 1006
-MISC ChangeLog 1632 RMD160 e2b3f4189b127ceeab3f0f29377cf53c34b0257a SHA1 bc6590169cdee039caa65d9165cebe3e635b0e63 SHA256 ea38f851de84a41f12fdf7d83158abe2032a387dea29e79f1b1ecec50282587f size 1632
-MD5 aad9f2d20a5e25cbd94df45827abd194 ChangeLog 1632
-RMD160 e2b3f4189b127ceeab3f0f29377cf53c34b0257a ChangeLog 1632
-SHA256 ea38f851de84a41f12fdf7d83158abe2032a387dea29e79f1b1ecec50282587f ChangeLog 1632
-MISC metadata.xml 206 RMD160 61d950942f566dfc272d4f115fa2fb390fbbe301 SHA1 3f059bf106cd99ac3eb9aab89e0708f5fa86ddf9 SHA256 91b15066df76a399233847c54c04eca1d95ab2b73fdef41207dfeb17dbb38193 size 206
+EBUILD gnome-mount-0.4-r4.ebuild 962 RMD160 bb225889cc86d82834d72f3dbd22b67ab2489c2b SHA1 29c03e022a3d7918bd5b1ba8f73a1eca828d05aa SHA256 aa1d9ea3f34ba3fe002b787b52d2616ce62300853d4652a20c738bb68d47e1f4
+MD5 3aeab6c45eb68644526bd583a6c3031a gnome-mount-0.4-r4.ebuild 962
+RMD160 bb225889cc86d82834d72f3dbd22b67ab2489c2b gnome-mount-0.4-r4.ebuild 962
+SHA256 aa1d9ea3f34ba3fe002b787b52d2616ce62300853d4652a20c738bb68d47e1f4 gnome-mount-0.4-r4.ebuild 962
+MISC ChangeLog 1943 RMD160 73abff8e4033a0a8526254e392e3b5723f1514f0 SHA1 fb5a0c907920bcbf497ae6da2cf3313742ee3ae1 SHA256 f4efdb31c5e88163bfb51c88886fbbe963e2271b138e7dac5b3ca193ca839368
+MD5 52dce13a588f3ab13f1fa2a983c70584 ChangeLog 1943
+RMD160 73abff8e4033a0a8526254e392e3b5723f1514f0 ChangeLog 1943
+SHA256 f4efdb31c5e88163bfb51c88886fbbe963e2271b138e7dac5b3ca193ca839368 ChangeLog 1943
+MISC metadata.xml 206 RMD160 61d950942f566dfc272d4f115fa2fb390fbbe301 SHA1 3f059bf106cd99ac3eb9aab89e0708f5fa86ddf9 SHA256 91b15066df76a399233847c54c04eca1d95ab2b73fdef41207dfeb17dbb38193
MD5 8f804bac2d3835f24ed9a73034f969a1 metadata.xml 206
RMD160 61d950942f566dfc272d4f115fa2fb390fbbe301 metadata.xml 206
SHA256 91b15066df76a399233847c54c04eca1d95ab2b73fdef41207dfeb17dbb38193 metadata.xml 206
MD5 76c05d7960a8436e6bc7d220bef1f23c files/digest-gnome-mount-0.4-r3 247
RMD160 38b79354b5e9ed2371393b9c9c45d5e228d2d665 files/digest-gnome-mount-0.4-r3 247
SHA256 f10621810bfe345f1c0576989c8f938017419cd5cd3c96f320d412831afadde7 files/digest-gnome-mount-0.4-r3 247
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v1.4.3-ecc0.1.6 (GNU/Linux)
-
-iD8DBQFEcPmlomPajV0RnrERAlFhAJoDSx5cwS4qng2pPWCIlZsU9HLxaQCfXgta
-d9T+OuL5lWsO0QEaJN8URqk=
-=xIYJ
------END PGP SIGNATURE-----
+MD5 76c05d7960a8436e6bc7d220bef1f23c files/digest-gnome-mount-0.4-r4 247
+RMD160 38b79354b5e9ed2371393b9c9c45d5e228d2d665 files/digest-gnome-mount-0.4-r4 247
+SHA256 f10621810bfe345f1c0576989c8f938017419cd5cd3c96f320d412831afadde7 files/digest-gnome-mount-0.4-r4 247
--- /dev/null
+--- gnome-mount-0.4/src/gnome-mount.c 2006-02-24 00:14:23.000000000 -0500
++++ gnome-mount-0.4.new/src/gnome-mount.c 2006-06-18 19:40:03.000000000 -0400
+@@ -238,7 +238,8 @@
+ /* #define MOUNT_ERROR_DIALOG_RESPONSE_INSTALL_DRIVER 10 see below */
+
+ static void
+-show_error_dialog_mount (LibHalVolume *volume, const char *error_name, const char *error_detail,
++show_error_dialog_mount (LibHalVolume *volume, LibHalDrive *drive,
++ const char *error_name, const char *error_detail,
+ const char *fstype_requested)
+ {
+ GtkWidget *w;
+@@ -266,7 +267,10 @@
+ 0,
+ _("Cannot mount volume"));
+
+- volume_name = libhal_volume_get_label (volume);
++ if (volume != NULL)
++ volume_name = libhal_volume_get_label (volume);
++ else
++ volume_name = NULL;
+
+ if (strcmp (error_name, "org.freedesktop.Hal.Device.Volume.PermissionDenied") == 0) {
+ gtk_message_dialog_format_secondary_text (
+@@ -289,8 +293,8 @@
+ volume_name != NULL ?
+ _("The volume '%s' uses the <i>%s</i> file system which is not supported by your system.") :
+ _("The volume uses the <i>%s</i> file system which is not supported by your system."),
+- volume_name != NULL ? volume_name : fstype_requested,
+- volume_name != NULL ? fstype_requested : "");
++ volume_name != NULL ? volume_name : (fstype_requested != NULL ? fstype_requested : ""),
++ volume_name != NULL ? (fstype_requested != NULL ? fstype_requested : "") : "");
+
+ /* some day.. :-)
+ gtk_dialog_add_buttons (GTK_DIALOG (w),
+@@ -463,9 +467,9 @@
+
+ notify_parent (FALSE);
+
+- show_error_dialog_mount (volume, error.name, error.message,
++ show_error_dialog_mount (volume, drive, error.name, error.message,
+ (fstype != NULL && strlen (fstype) > 0) ?
+- fstype : libhal_volume_get_fstype (volume));
++ fstype : (volume != NULL ? libhal_volume_get_fstype (volume) : NULL));
+
+ dbus_error_free (&error);
+ goto out;
+@@ -573,6 +577,226 @@
+ return flags;
+ }
+
++
++static gboolean
++fstab_open (gpointer *handle)
++{
++#ifdef __FreeBSD__
++ return setfsent () == 1;
++#else
++ *handle = fopen ("/etc/fstab", "r");
++ return *handle != NULL;
++#endif
++}
++
++static char *
++fstab_next (gpointer handle, char **mount_point)
++{
++#ifdef __FreeBSD__
++ struct fstab *fstab;
++
++ fstab = getfsent ();
++
++ /* TODO: fill out mount_point */
++ if (mount_point != NULL && fstab != NULL) {
++ *mount_point = fstab->fs_file;
++ }
++
++ return fstab ? fstab->fs_spec : NULL;
++#else
++ struct mntent *mnt;
++
++ mnt = getmntent (handle);
++
++ if (mount_point != NULL && mnt != NULL) {
++ *mount_point = mnt->mnt_dir;
++ }
++
++ return mnt ? mnt->mnt_fsname : NULL;
++#endif
++}
++
++
++static void
++fstab_close (gpointer handle)
++{
++#ifdef __FreeBSD__
++ endfsent ();
++#else
++ fclose (handle);
++#endif
++}
++
++
++/* borrowed from gtk/gtkfilesystemunix.c in GTK+ on 02/23/2006 */
++static void
++canonicalize_filename (gchar *filename)
++{
++ gchar *p, *q;
++ gboolean last_was_slash = FALSE;
++
++ p = filename;
++ q = filename;
++
++ while (*p)
++ {
++ if (*p == G_DIR_SEPARATOR)
++ {
++ if (!last_was_slash)
++ *q++ = G_DIR_SEPARATOR;
++
++ last_was_slash = TRUE;
++ }
++ else
++ {
++ if (last_was_slash && *p == '.')
++ {
++ if (*(p + 1) == G_DIR_SEPARATOR ||
++ *(p + 1) == '\0')
++ {
++ if (*(p + 1) == '\0')
++ break;
++
++ p += 1;
++ }
++ else if (*(p + 1) == '.' &&
++ (*(p + 2) == G_DIR_SEPARATOR ||
++ *(p + 2) == '\0'))
++ {
++ if (q > filename + 1)
++ {
++ q--;
++ while (q > filename + 1 &&
++ *(q - 1) != G_DIR_SEPARATOR)
++ q--;
++ }
++
++ if (*(p + 2) == '\0')
++ break;
++
++ p += 2;
++ }
++ else
++ {
++ *q++ = *p;
++ last_was_slash = FALSE;
++ }
++ }
++ else
++ {
++ *q++ = *p;
++ last_was_slash = FALSE;
++ }
++ }
++
++ p++;
++ }
++
++ if (q > filename + 1 && *(q - 1) == G_DIR_SEPARATOR)
++ q--;
++
++ *q = '\0';
++}
++
++static char *
++resolve_symlink (const char *file)
++{
++ GError *error;
++ char *dir;
++ char *link;
++ char *f;
++ char *f1;
++
++ f = g_strdup (file);
++
++ while (g_file_test (f, G_FILE_TEST_IS_SYMLINK)) {
++ link = g_file_read_link (f, &error);
++ if (link == NULL) {
++ g_warning ("Cannot resolve symlink %s: %s", f, error->message);
++ g_error_free (error);
++ g_free (f);
++ f = NULL;
++ goto out;
++ }
++
++ dir = g_path_get_dirname (f);
++ f1 = g_strdup_printf ("%s/%s", dir, link);
++ g_free (dir);
++ g_free (link);
++ g_free (f);
++ f = f1;
++ }
++
++out:
++ if (f != NULL)
++ canonicalize_filename (f);
++ return f;
++}
++
++static gboolean
++is_in_fstab (const char *device_file, const char *label, const char *uuid, char **mount_point)
++{
++ gboolean ret;
++ gpointer handle;
++ char *entry;
++ char *_mount_point;
++
++ ret = FALSE;
++
++ /* check if /etc/fstab mentions this device... (with symlinks etc) */
++ if (!fstab_open (&handle)) {
++ handle = NULL;
++ goto out;
++ }
++
++ while ((entry = fstab_next (handle, &_mount_point)) != NULL) {
++ char *resolved;
++
++ if (label != NULL && g_str_has_prefix (entry, "LABEL=")) {
++ if (strcmp (entry + 6, label) == 0) {
++ ret = TRUE;
++ if (mount_point != NULL)
++ *mount_point = g_strdup (_mount_point);
++ goto out;
++ }
++ }
++
++ if (uuid != NULL && g_str_has_prefix (entry, "UUID=")) {
++ if (strcmp (entry + 5, uuid) == 0) {
++ ret = TRUE;
++ if (mount_point != NULL)
++ *mount_point = g_strdup (_mount_point);
++ goto out;
++ }
++ }
++
++ resolved = resolve_symlink (entry);
++ if (strcmp (device_file, resolved) == 0) {
++ ret = TRUE;
++ g_free (resolved);
++ if (mount_point != NULL)
++ *mount_point = g_strdup (_mount_point);
++ goto out;
++ }
++
++ g_free (resolved);
++ }
++
++out:
++ if (handle != NULL)
++ fstab_close (handle);
++
++ return ret;
++}
++
++#ifdef __FreeBSD__
++#define MOUNT "/sbin/mount"
++#define UMOUNT "/sbin/umount"
++#else
++#define MOUNT "/bin/mount"
++#define UMOUNT "/bin/umount"
++#endif
++
+ static gboolean
+ volume_mount (const char *udi, LibHalVolume *volume, LibHalDrive *drive)
+ {
+@@ -587,9 +811,89 @@
+ char *key;
+ gboolean ret;
+ const char *fstype;
++ const char *device_file;
++ const char *label;
++ const char *uuid;
+
+ ret = FALSE;
+
++ g_debug ("Mounting %s", udi);
++
++ /* check if it's in /etc/fstab */
++ label = NULL;
++ uuid = NULL;
++ device_file = NULL;
++ if (volume != NULL) {
++ label = libhal_volume_get_label (volume);
++ uuid = libhal_volume_get_uuid (volume);
++ device_file = libhal_volume_get_device_file (volume);
++ } else if (drive != NULL) {
++ device_file = libhal_drive_get_device_file (drive);
++ }
++ if (device_file != NULL) {
++ char *mount_point = NULL;
++
++ if (is_in_fstab (device_file, label, uuid, &mount_point)) {
++ GError *err = NULL;
++ char *sout = NULL;
++ char *serr = NULL;
++ int exit_status;
++ char *args[3] = {MOUNT, NULL, NULL};
++ char **envp = {NULL};
++
++ g_print (_("Device %s is in /etc/fstab with mount point \"%s\"\n"),
++ device_file, mount_point);
++ args[1] = mount_point;
++ if (!g_spawn_sync ("/",
++ args,
++ envp,
++ 0,
++ NULL,
++ NULL,
++ &sout,
++ &serr,
++ &exit_status,
++ &err)) {
++ g_warning ("Cannot execute %s\n", MOUNT);
++ g_free (mount_point);
++ goto out;
++ }
++
++ if (exit_status != 0) {
++ char errstr[] = "mount: unknown filesystem type";
++
++ g_warning ("%s said error %d, stdout='%s', stderr='%s'\n",
++ MOUNT, exit_status, sout, serr);
++
++ if (strstr (serr, "unknown filesystem type") != NULL) {
++ show_error_dialog_mount (volume, drive, "org.freedesktop.Hal.Device.Volume.UnknownFilesystemType", serr, NULL);
++ } else if (strstr (serr, "already mounted") != NULL) {
++ show_error_dialog_mount (volume, drive, "org.freedesktop.Hal.Device.Volume.AlreadyMounted", serr, NULL);
++ } else if (strstr (serr, "only root") != NULL) {
++ show_error_dialog_mount (volume, drive, "org.freedesktop.Hal.Device.Volume.PermissionDenied", serr, NULL);
++ } else if (strstr (serr, "bad option") != NULL) {
++ show_error_dialog_mount (volume, drive, "org.freedesktop.Hal.Device.Volume.InvalidMountOption", serr, NULL);
++ } else {
++ show_error_dialog_mount (volume, drive, "org.freedesktop.Hal.Device.Volume.UnknownFailure", serr, NULL);
++ }
++
++ g_free (mount_point);
++ goto out;
++
++ }
++
++ g_print (_("Mounted %s at \"%s\" (using /etc/fstab)\n"), device_file, mount_point);
++
++ g_free (mount_point);
++ ret = TRUE;
++ goto out;
++
++ }
++ g_free (mount_point);
++ }
++
++
++
+ if (volume != NULL) {
+ fstype = libhal_volume_get_fstype (volume);
+ } else {
+@@ -690,6 +994,7 @@
+
+ g_free (mount_point);
+
++out:
+ return ret;
+ }
+
+@@ -697,15 +1002,89 @@
+ static gboolean
+ volume_unmount (const char *udi, LibHalVolume *volume, LibHalDrive *drive)
+ {
+- gboolean ret = FALSE;
++ gboolean ret;
+ DBusMessage *msg = NULL;
+ DBusMessage *reply = NULL;
+ DBusError error;
+ char **options = NULL;
+ unsigned int num_options = 0;
++ const char *fstype;
++ const char *device_file;
++ const char *label;
++ const char *uuid;
++
++ ret = FALSE;
+
+ g_debug ("Unmounting %s", udi);
+
++ /* check if it's in /etc/fstab */
++ label = NULL;
++ uuid = NULL;
++ device_file = NULL;
++ if (volume != NULL) {
++ label = libhal_volume_get_label (volume);
++ uuid = libhal_volume_get_uuid (volume);
++ device_file = libhal_volume_get_device_file (volume);
++ } else if (drive != NULL) {
++ device_file = libhal_drive_get_device_file (drive);
++ }
++ if (device_file != NULL) {
++ char *mount_point = NULL;
++
++ if (is_in_fstab (device_file, label, uuid, &mount_point)) {
++ GError *err = NULL;
++ char *sout = NULL;
++ char *serr = NULL;
++ int exit_status;
++ char *args[3] = {UMOUNT, NULL, NULL};
++ char **envp = {NULL};
++
++ g_print (_("Device %s is in /etc/fstab with mount point \"%s\"\n"),
++ device_file, mount_point);
++ args[1] = mount_point;
++ if (!g_spawn_sync ("/",
++ args,
++ envp,
++ 0,
++ NULL,
++ NULL,
++ &sout,
++ &serr,
++ &exit_status,
++ &err)) {
++ g_warning ("Cannot execute %s\n", UMOUNT);
++ g_free (mount_point);
++ goto out;
++ }
++
++ if (exit_status != 0) {
++ g_warning ("%s said error %d, stdout='%s', stderr='%s'\n",
++ UMOUNT, exit_status, sout, serr);
++ g_free (mount_point);
++
++ if (strstr (serr, "is busy") != NULL) {
++ show_error_dialog_unmount (udi, volume, drive, "org.freedesktop.Hal.Device.Volume.Busy", serr);
++ } else if (strstr (serr, "not mounted") != NULL) {
++ show_error_dialog_unmount (udi, volume, drive, "org.freedesktop.Hal.Device.Volume.NotMounted", serr);
++ } else if (strstr (serr, "only root") != NULL) {
++ show_error_dialog_unmount (udi, volume, drive, "org.freedesktop.Hal.Device.Volume.PermissionDenied", serr);
++ } else {
++ show_error_dialog_unmount (udi, volume, drive, "org.freedesktop.Hal.Device.Volume.UnknownFailure", serr);
++ }
++
++ goto out;
++ }
++
++ g_print (_("Unmounted %s (using /etc/fstab).\n"), device_file);
++
++ g_free (mount_point);
++ ret = TRUE;
++ goto out;
++
++ }
++ g_free (mount_point);
++ }
++
+ msg = dbus_message_new_method_call ("org.freedesktop.Hal", udi,
+ "org.freedesktop.Hal.Device.Volume",
+ "Unmount");
+@@ -752,8 +1131,82 @@
+ DBusError error;
+ char **options = NULL;
+ unsigned int num_options = 0;
++ const char *fstype;
++ const char *device_file;
++ const char *label;
++ const char *uuid;
++
++ ret = FALSE;
+
+ g_debug ("Ejecting %s", udi);
++
++ /* check if it's in /etc/fstab */
++ label = NULL;
++ uuid = NULL;
++ device_file = NULL;
++ if (volume != NULL) {
++ label = libhal_volume_get_label (volume);
++ uuid = libhal_volume_get_uuid (volume);
++ device_file = libhal_volume_get_device_file (volume);
++ } else if (drive != NULL) {
++ device_file = libhal_drive_get_device_file (drive);
++ }
++ if (device_file != NULL) {
++ char *mount_point = NULL;
++
++ if (is_in_fstab (device_file, label, uuid, &mount_point)) {
++ GError *err = NULL;
++ char *sout = NULL;
++ char *serr = NULL;
++ int exit_status;
++ char *args[3] = {"eject", NULL, NULL};
++ char **envp = {NULL};
++
++ g_print (_("Device %s is in /etc/fstab with mount point \"%s\"\n"),
++ device_file, mount_point);
++ args[1] = mount_point;
++ if (!g_spawn_sync ("/",
++ args,
++ envp,
++ G_SPAWN_SEARCH_PATH,
++ NULL,
++ NULL,
++ &sout,
++ &serr,
++ &exit_status,
++ &err)) {
++ g_warning ("Cannot execute %s\n", "eject");
++ g_free (mount_point);
++ goto out;
++ }
++
++ if (exit_status != 0) {
++ g_warning ("%s said error %d, stdout='%s', stderr='%s'\n",
++ "eject", exit_status, sout, serr);
++ g_free (mount_point);
++
++ if (strstr (serr, "is busy") != NULL) {
++ show_error_dialog_eject (udi, volume, drive, "org.freedesktop.Hal.Device.Volume.Busy", serr);
++ } else if (strstr (serr, "only root") != NULL) {
++ show_error_dialog_eject (udi, volume, drive, "org.freedesktop.Hal.Device.Volume.PermissionDenied", serr);
++ } else if (strstr (serr, "unable to open") != NULL) {
++ show_error_dialog_eject (udi, volume, drive, "org.freedesktop.Hal.Device.Volume.PermissionDenied", serr);
++ } else {
++ show_error_dialog_eject (udi, volume, drive, "org.freedesktop.Hal.Device.Volume.UnknownFailure", serr);
++ }
++
++ goto out;
++ }
++
++ g_print (_("Ejected %s (using /etc/fstab).\n"), device_file);
++
++ g_free (mount_point);
++ ret = TRUE;
++ goto out;
++
++ }
++ g_free (mount_point);
++ }
+
+ msg = dbus_message_new_method_call ("org.freedesktop.Hal", udi,
+ "org.freedesktop.Hal.Device.Volume",
+@@ -1255,112 +1708,6 @@
+ {
+ }
+
+-
+-/* borrowed from gtk/gtkfilesystemunix.c in GTK+ on 02/23/2006 */
+-static void
+-canonicalize_filename (gchar *filename)
+-{
+- gchar *p, *q;
+- gboolean last_was_slash = FALSE;
+-
+- p = filename;
+- q = filename;
+-
+- while (*p)
+- {
+- if (*p == G_DIR_SEPARATOR)
+- {
+- if (!last_was_slash)
+- *q++ = G_DIR_SEPARATOR;
+-
+- last_was_slash = TRUE;
+- }
+- else
+- {
+- if (last_was_slash && *p == '.')
+- {
+- if (*(p + 1) == G_DIR_SEPARATOR ||
+- *(p + 1) == '\0')
+- {
+- if (*(p + 1) == '\0')
+- break;
+-
+- p += 1;
+- }
+- else if (*(p + 1) == '.' &&
+- (*(p + 2) == G_DIR_SEPARATOR ||
+- *(p + 2) == '\0'))
+- {
+- if (q > filename + 1)
+- {
+- q--;
+- while (q > filename + 1 &&
+- *(q - 1) != G_DIR_SEPARATOR)
+- q--;
+- }
+-
+- if (*(p + 2) == '\0')
+- break;
+-
+- p += 2;
+- }
+- else
+- {
+- *q++ = *p;
+- last_was_slash = FALSE;
+- }
+- }
+- else
+- {
+- *q++ = *p;
+- last_was_slash = FALSE;
+- }
+- }
+-
+- p++;
+- }
+-
+- if (q > filename + 1 && *(q - 1) == G_DIR_SEPARATOR)
+- q--;
+-
+- *q = '\0';
+-}
+-
+-static char *
+-resolve_symlink (const char *file)
+-{
+- GError *error;
+- char *dir;
+- char *link;
+- char *f;
+- char *f1;
+-
+- f = g_strdup (file);
+-
+- while (g_file_test (f, G_FILE_TEST_IS_SYMLINK)) {
+- link = g_file_read_link (f, &error);
+- if (link == NULL) {
+- g_warning ("Cannot resolve symlink %s: %s", f, error->message);
+- g_error_free (error);
+- g_free (f);
+- f = NULL;
+- goto out;
+- }
+-
+- dir = g_path_get_dirname (f);
+- f1 = g_strdup_printf ("%s/%s", dir, link);
+- g_free (dir);
+- g_free (link);
+- g_free (f);
+- f = f1;
+- }
+-
+-out:
+- if (f != NULL)
+- canonicalize_filename (f);
+- return f;
+-}
+-
+ int
+ main (int argc, char *argv[])
+ {
+@@ -1689,7 +2036,8 @@
+
+ goto out;
+
+- } else if (fsusage == LIBHAL_VOLUME_USAGE_MOUNTABLE_FILESYSTEM) {
++ } else if (fsusage == LIBHAL_VOLUME_USAGE_MOUNTABLE_FILESYSTEM ||
++ fsusage == LIBHAL_VOLUME_USAGE_UNKNOWN) {
+ if (volume_mount (udi, volume, drive))
+ rc = 0;
+ }
+@@ -1700,7 +2048,7 @@
+
+ out:
+ if (drive != NULL)
+- libhal_volume_free (volume);
++ libhal_drive_free (drive);
+
+ if (volume != NULL)
+ libhal_volume_free (volume);