# Patch for fixing hal locking when device is in fstab # https://bugs.gentoo.org/show_bug.cgi?id=257746 diff -p -up a/src/gnome-mount.c b/src/gnome-mount.c --- a/src/gnome-mount.c 2008-09-15 14:39:28.000000000 +0200 +++ b/src/gnome-mount.c 2008-09-15 14:42:54.000000000 +0200 @@ -1166,6 +1166,18 @@ volume_mount (const char *udi, LibHalVol char *args[3] = {MOUNT, NULL, NULL}; char **envp = {NULL}; + /* don't mount if device is locked + */ + if (libhal_device_is_locked_by_others (hal_ctx, + udi, + "org.freedesktop.Hal.Device.Storage", + NULL)) { + if (opt_verbose) + g_message (_("Device %s is locked, aborting"), + udi); + goto out; + } + if (opt_verbose) g_print (_("Device %s is in /etc/fstab with mount point \"%s\"\n"), device_file, mount_point_fstab); @@ -1738,6 +1750,17 @@ volume_unmount (const char *udi, LibHalV char *args[3] = {UMOUNT, NULL, NULL}; char **envp = {NULL}; + /* don't unmount if device is locked + */ + if (libhal_device_is_locked_by_others (hal_ctx, + udi, + "org.freedesktop.Hal.Device.Storage", + NULL)) { + if (opt_verbose) + g_message (_("Device %s is locked, aborting"), + udi); + goto out; + } if (opt_verbose) g_print (_("Device %s is in /etc/fstab with mount point \"%s\"\n"), device_file, mount_point); @@ -1958,6 +1981,18 @@ volume_eject (const char *udi, LibHalVol char *args[3] = {"eject", NULL, NULL}; char **envp = {NULL}; + /* don't mount if device is locked + */ + if (libhal_device_is_locked_by_others (hal_ctx, + udi, + "org.freedesktop.Hal.Device.Storage", + NULL)) { + if (opt_verbose) + g_message (_("Device %s is locked, aborting"), + udi); + goto out; + } + if (opt_verbose) g_print (_("Device %s is in /etc/fstab with mount point \"%s\"\n"), device_file, mount_point);