From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59310) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VUbrT-0007tf-D5 for qemu-devel@nongnu.org; Fri, 11 Oct 2013 08:30:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VUbrN-0005bf-EB for qemu-devel@nongnu.org; Fri, 11 Oct 2013 08:30:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:13121) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VUbrN-0005ba-6A for qemu-devel@nongnu.org; Fri, 11 Oct 2013 08:30:25 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r9BCULbe027738 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 11 Oct 2013 08:30:24 -0400 From: Max Reitz Date: Fri, 11 Oct 2013 14:30:16 +0200 Message-Id: <1381494616-1544-1-git-send-email-mreitz@redhat.com> Subject: [Qemu-devel] [PATCH] block/raw-win32: Always use -errno in hdev_open List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Stefan Hajnoczi , Max Reitz On one occasion, hdev_open() returned -1 in case of an unknown error instead of a proper -errno value. Adjust this to match the behavior of raw_open() (in raw-win32), which is to return -EINVAL in this case. Also, change the call to error_setg*() to match the one in raw_open() as well. Signed-off-by: Max Reitz --- Follow-up to (as suggested by Eric): - block/raw-win32: Employ error parameter (3/5 from the "block: Employ error parameter" series) --- block/raw-win32.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/block/raw-win32.c b/block/raw-win32.c index c3e4c62..676b570 100644 --- a/block/raw-win32.c +++ b/block/raw-win32.c @@ -590,12 +590,11 @@ static int hdev_open(BlockDriverState *bs, QDict *options, int flags, int err = GetLastError(); if (err == ERROR_ACCESS_DENIED) { - error_setg_errno(errp, EACCES, "Could not open device"); ret = -EACCES; } else { - error_setg(errp, "Could not open device"); - ret = -1; + ret = -EINVAL; } + error_setg_errno(errp, -ret, "Could not open device"); goto done; } -- 1.8.3.1