From a47b91cb8f432f410b5b8a4c1535652b6b778d8b Mon Sep 17 00:00:00 2001 From: David Zeuthen Date: Thu, 11 Aug 2011 16:27:43 -0400 Subject: [PATCH] Also consider the device file in addition to symlinks Otherwise things like /dev/sr0 in the /etc/{fstab,crypttab} files won't work. Signed-off-by: David Zeuthen --- src/udiskslinuxblock.c | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/src/udiskslinuxblock.c b/src/udiskslinuxblock.c index d8cfe23..cd9dc21 100644 --- a/src/udiskslinuxblock.c +++ b/src/udiskslinuxblock.c @@ -1329,14 +1329,21 @@ find_fstab_entries_for_device (UDisksLinuxBlock *block) goto continue_loop; } - symlinks = udisks_block_device_get_symlinks (block->iface_block_device); - if (symlinks != NULL) + if (g_strcmp0 (device, udisks_block_device_get_device (block->iface_block_device)) == 0) { - for (n = 0; symlinks[n] != NULL; n++) + ret = g_list_prepend (ret, g_object_ref (entry)); + } + else + { + symlinks = udisks_block_device_get_symlinks (block->iface_block_device); + if (symlinks != NULL) { - if (g_strcmp0 (device, symlinks[n]) == 0) + for (n = 0; symlinks[n] != NULL; n++) { - ret = g_list_prepend (ret, g_object_ref (entry)); + if (g_strcmp0 (device, symlinks[n]) == 0) + { + ret = g_list_prepend (ret, g_object_ref (entry)); + } } } } @@ -1389,14 +1396,21 @@ find_crypttab_entries_for_device (UDisksLinuxBlock *block) goto continue_loop; } - symlinks = udisks_block_device_get_symlinks (block->iface_block_device); - if (symlinks != NULL) + if (g_strcmp0 (device, udisks_block_device_get_device (block->iface_block_device)) == 0) { - for (n = 0; symlinks[n] != NULL; n++) + ret = g_list_prepend (ret, g_object_ref (entry)); + } + else + { + symlinks = udisks_block_device_get_symlinks (block->iface_block_device); + if (symlinks != NULL) { - if (g_strcmp0 (device, symlinks[n]) == 0) + for (n = 0; symlinks[n] != NULL; n++) { - ret = g_list_prepend (ret, g_object_ref (entry)); + if (g_strcmp0 (device, symlinks[n]) == 0) + { + ret = g_list_prepend (ret, g_object_ref (entry)); + } } } } -- 2.7.4