Received: from eggs.gnu.org ([2001:4830:134:3::10]:57854) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vdluh-0001In-H2 for qemu-devel@nongnu.org; Tue, 05 Nov 2013 14:03:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vdlub-0006f5-HY for qemu-devel@nongnu.org; Tue, 05 Nov 2013 14:03:43 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56603) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vdlub-0006ex-AJ for qemu-devel@nongnu.org; Tue, 05 Nov 2013 14:03:37 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rA5J3aB1015601 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 5 Nov 2013 14:03:36 -0500 From: Max Reitz Date: Tue, 5 Nov 2013 20:03:33 +0100 Message-Id: <1383678213-2497-1-git-send-email-mreitz@redhat.com> Subject: [Qemu-devel] [PATCH] block: Save errno before error_setg_errno List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Stefan Hajnoczi , Max Reitz error_setg_errno() may overwrite errno; therefore, its value should be read before calling that function and not afterwards. Signed-off-by: Max Reitz --- block.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; } -- 1.8.4.2