diff options
author | Pierre-Alexandre Meyer <pierre@mouraf.org> | 2009-08-22 11:08:04 -0700 |
---|---|---|
committer | Pierre-Alexandre Meyer <pierre@mouraf.org> | 2009-08-22 11:08:04 -0700 |
commit | 80726ee72df67c2c27ee8a58561e08a9cac30e9c (patch) | |
tree | 3277e81eb11732b05b1459258a26d7c7faef9df0 /com32/hdt/hdt-cli-disk.c | |
parent | 6bc9a8305bca8c933da90481f536407b733b806f (diff) | |
download | hdt-80726ee72df67c2c27ee8a58561e08a9cac30e9c.tar.gz hdt-80726ee72df67c2c27ee8a58561e08a9cac30e9c.tar.xz hdt-80726ee72df67c2c27ee8a58561e08a9cac30e9c.zip |
hdt: enhance error reporting in the CLI (disk)
parse_partition_table can fail for two reasons: disk I/O
error or unrecognized partition layout (non msdos, corrupt, ...).
In the latter case, we were displaying
Error parsing disk 0x80
parse_partition_table: error 0
which is confusing. We now display
Disk 0x80: unrecognized partition layout
or the errno_disk in case of I/O errors.
Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
Diffstat (limited to 'com32/hdt/hdt-cli-disk.c')
-rw-r--r-- | com32/hdt/hdt-cli-disk.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/com32/hdt/hdt-cli-disk.c b/com32/hdt/hdt-cli-disk.c index fec98a15..4e2994d9 100644 --- a/com32/hdt/hdt-cli-disk.c +++ b/com32/hdt/hdt-cli-disk.c @@ -137,8 +137,13 @@ void main_show_disk(int argc, char **argv, remove_spaces(d->edd_params.host_bus_type), remove_spaces(d->edd_params.interface_type)); if (parse_partition_table(d, &show_partition_information)) { - fprintf(stderr, "Error parsing disk 0x%X\n", d->disk); - get_error("parse_partition_table"); + if (errno_disk) { + fprintf(stderr, "I/O error parsing disk 0x%X\n", d->disk); + get_error("parse_partition_table"); + } else { + fprintf(stderr, "Disk 0x%X: unrecognized partition layout\n", d->disk); + } + fprintf(stderr, "\n"); } } |