Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomeu Vizoso <tomeu@tomeuvizoso.net>2008-01-24 23:52:38 (GMT)
committer Tomeu Vizoso <tomeu@tomeuvizoso.net>2008-01-24 23:55:41 (GMT)
commitc7d258c50e6aa7129bf9fa36e24a2a0507c542d9 (patch)
tree8f1b021e7d6147db9d0190a16751e54c3dbb8e21
parent8ce66e4f3381b082452e96f4eba0590634343916 (diff)
#6029 Don't fail when the mount point is already occupied.
-rw-r--r--NEWS2
-rw-r--r--volumesmanager.py18
2 files changed, 19 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index c1f2593..2f072c3 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,5 @@
+* #6029 Don't fail when the mount point is already occupied. (tomeu)
+
83
* #5863 Correctly invalidate icon cache. (tomeu)
diff --git a/volumesmanager.py b/volumesmanager.py
index 91efc81..6147681 100644
--- a/volumesmanager.py
+++ b/volumesmanager.py
@@ -156,7 +156,23 @@ class VolumesManager(gobject.GObject):
mount_point = device.GetProperty('volume.uuid')
volume = dbus.Interface(device_object, HAL_VOLUME_IFACE)
- volume.Mount(mount_point, fs_type, options)
+
+ # Try 100 times to get a mount point
+ mounted = False
+ i = 0
+ while not mounted:
+ try:
+ if i > 0:
+ volume.Mount('%s_%d' % (mount_point, i), fs_type, options)
+ else:
+ volume.Mount(mount_point, fs_type, options)
+ mounted = True
+ except dbus.DBusException, e:
+ if i < 100 and e.get_dbus_name() == \
+ 'org.freedesktop.Hal.Device.Volume.MountPointNotAvailable':
+ i += 1
+ else:
+ raise
def _hal_device_property_modified_cb(self, udi, count, changes):
if 'volume.is_mounted' in [change[0] for change in changes]: