1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
# 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);
|