diff options
author | Ondrej Holy <oholy@redhat.com> | 2014-06-24 10:50:13 +0200 |
---|---|---|
committer | Martin Pitt <martin.pitt@ubuntu.com> | 2015-06-30 08:54:44 +0200 |
commit | ae81a48551395a63e0ed7f6a15ab91bf1a42e903 (patch) | |
tree | 7cbd676fbe2a10a97345495ed58cacb188c5a1f9 /src/udiskslinuxblock.c | |
parent | 6102a739f1fc6837856e9da757ce0a0dfe7f8d31 (diff) | |
download | udisks-ae81a48551395a63e0ed7f6a15ab91bf1a42e903.tar.gz |
Fail before formatting if partition contains a partition table
Formatting fails for a partition containing a partition table (e.g. Fedora
hybrid iso). Consequently the device is in wrong state, so check it before
modification and fail with a comprehensible error message.
https://bugs.freedesktop.org/show_bug.cgi?id=76178
Diffstat (limited to 'src/udiskslinuxblock.c')
-rw-r--r-- | src/udiskslinuxblock.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/udiskslinuxblock.c b/src/udiskslinuxblock.c index 9e29a9a..e266497 100644 --- a/src/udiskslinuxblock.c +++ b/src/udiskslinuxblock.c @@ -2211,6 +2211,19 @@ handle_format (UDisksBlock *block, if (partition != NULL) { UDisksObject *partition_table_object; + + /* Fail if partition contains a partition table (e.g. Fedora Hybrid ISO). + * See: https://bugs.freedesktop.org/show_bug.cgi?id=76178 + */ + if (udisks_partition_get_offset (partition) == 0) + { + g_dbus_method_invocation_return_error (invocation, + UDISKS_ERROR, + UDISKS_ERROR_NOT_SUPPORTED, + "This partition cannot be modified because it contains a partition table; please reinitialize layout of the whole device."); + goto out; + } + partition_table_object = udisks_daemon_find_object (daemon, udisks_partition_get_table (partition)); if (partition_table_object == NULL) { |