Force ReadOnly to TRUE for optical drives
authorDavid Zeuthen <davidz@redhat.com>
Fri, 9 Dec 2011 17:08:35 +0000 (12:08 -0500)
committerDavid Zeuthen <davidz@redhat.com>
Fri, 9 Dec 2011 17:08:35 +0000 (12:08 -0500)
At least do this until the kernel sets the 'ro' property properly.

Signed-off-by: David Zeuthen <davidz@redhat.com>
src/udiskslinuxblock.c

index eeb4a4d..8d16a27 100644 (file)
@@ -638,6 +638,8 @@ udisks_linux_block_update (UDisksLinuxBlock        *block,
   udisks_block_set_size (iface, size);
 
   read_only = g_udev_device_get_sysfs_attr_as_boolean (device, "ro");
+  if (!read_only && g_str_has_prefix (g_udev_device_get_name (device), "sr"))
+    read_only = TRUE;
   udisks_block_set_read_only (iface, read_only);
 
   /* dm-crypt