summaryrefslogtreecommitdiffstats
path: root/block.c
diff options
context:
space:
mode:
authorMax Reitz <mreitz@redhat.com>2013-11-05 20:03:33 +0100
committerStefan Hajnoczi <stefanha@redhat.com>2013-11-07 13:58:58 +0100
commit17826bc159893300a05551d8a830275c5ecf0092 (patch)
tree9796d997c2fa6a5b5e21a71c252178bb38628e40 /block.c
parent43cd209803d6cffb1e1a028c9ff2fd0ff4fce954 (diff)
downloadhqemu-17826bc159893300a05551d8a830275c5ecf0092.zip
hqemu-17826bc159893300a05551d8a830275c5ecf0092.tar.gz
block: Save errno before error_setg_errno
error_setg_errno() may overwrite errno; therefore, its value should be read before calling that function and not afterwards. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Benoit Canet <benoit@irqsave.net> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'block.c')
-rw-r--r--block.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/block.c b/block.c
index 58efb5b..0e96a22 100644
--- a/block.c
+++ b/block.c
@@ -1084,8 +1084,8 @@ int bdrv_open(BlockDriverState *bs, const char *filename, QDict *options,
snprintf(backing_filename, sizeof(backing_filename),
"%s", filename);
} else if (!realpath(filename, backing_filename)) {
- error_setg_errno(errp, errno, "Could not resolve path '%s'", filename);
ret = -errno;
+ error_setg_errno(errp, errno, "Could not resolve path '%s'", filename);
goto fail;
}
OpenPOWER on IntegriCloud