diff options
author | Markus Armbruster <armbru@redhat.com> | 2015-12-18 16:35:10 +0100 |
---|---|---|
committer | Timothy Pearson <tpearson@raptorengineering.com> | 2019-11-29 19:28:24 -0600 |
commit | 674380db88c129f88078287e952d984739e6ccfc (patch) | |
tree | a80d12590038801c93b20177d3e3d8e68f893cd2 | |
parent | d2161040d14d934d2f9a4b8f54d07b9e5b25f54b (diff) | |
download | hqemu-674380db88c129f88078287e952d984739e6ccfc.zip hqemu-674380db88c129f88078287e952d984739e6ccfc.tar.gz |
qemu-nbd: Clean up "Failed to load snapshot" error message
bdrv_snapshot_load_tmp() sets an error and returns -errno on failure.
We report both even though the error message is self-contained. Drop
the redundant strerror().
While there: setting errno right before exit() is pointless, so drop
that, too.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <1450452927-8346-8-git-send-email-armbru@redhat.com>
-rw-r--r-- | qemu-nbd.c | 14 |
1 files changed, 5 insertions, 9 deletions
@@ -156,8 +156,7 @@ static int find_partition(BlockBackend *blk, int partition, int ret; if ((ret = blk_read(blk, 0, data, 1)) < 0) { - errno = -ret; - error_report("error while reading: %s", strerror(errno)); + error_report("error while reading: %s", strerror(-ret)); exit(EXIT_FAILURE); } @@ -178,8 +177,7 @@ static int find_partition(BlockBackend *blk, int partition, int j; if ((ret = blk_read(blk, mbr[i].start_sector_abs, data1, 1)) < 0) { - errno = -ret; - error_report("error while reading: %s", strerror(errno)); + error_report("error while reading: %s", strerror(-ret)); exit(EXIT_FAILURE); } @@ -721,9 +719,8 @@ int main(int argc, char **argv) &local_err); } if (ret < 0) { - errno = -ret; - error_report("Failed to load snapshot: %s: %s", - error_get_pretty(local_err), strerror(errno)); + error_report("Failed to load snapshot: %s", + error_get_pretty(local_err)); exit(EXIT_FAILURE); } @@ -738,9 +735,8 @@ int main(int argc, char **argv) if (partition != -1) { ret = find_partition(blk, partition, &dev_offset, &fd_size); if (ret < 0) { - errno = -ret; error_report("Could not find partition %d: %s", partition, - strerror(errno)); + strerror(-ret)); exit(EXIT_FAILURE); } } |