gnome-mount r202 - in trunk: . src



Author: fcrozat
Date: Fri Feb 20 14:00:32 2009
New Revision: 202
URL: http://svn.gnome.org/viewvc/gnome-mount?rev=202&view=rev

Log:
2009-02-20  Frederic Crozat  <fcrozat mandriva com>

        * src/gnome-mount.c: Respect lock even for device in fstab
        (bug #551841).



Modified:
   trunk/ChangeLog
   trunk/src/gnome-mount.c

Modified: trunk/src/gnome-mount.c
==============================================================================
--- trunk/src/gnome-mount.c	(original)
+++ trunk/src/gnome-mount.c	Fri Feb 20 14:00:32 2009
@@ -1171,6 +1171,18 @@
 			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);
@@ -1822,6 +1834,17 @@
 			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);
@@ -2047,6 +2070,18 @@
 			char *args[3] = {"eject", NULL, NULL};
 			char *envp[3] = {"LC_ALL=C", "LANG=C", 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);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]