Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nq4Me-0001G9-HF for qemu-devel@nongnu.org; Fri, 12 Mar 2010 07:53:16 -0500 Received: from [199.232.76.173] (port=41505 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nq4Me-0001Ft-8R for qemu-devel@nongnu.org; Fri, 12 Mar 2010 07:53:16 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1Nq4Md-0003lt-6H for qemu-devel@nongnu.org; Fri, 12 Mar 2010 07:53:16 -0500 Received: from mx1.redhat.com ([209.132.183.28]:22937) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Nq4Mc-0003li-QD for qemu-devel@nongnu.org; Fri, 12 Mar 2010 07:53:15 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o2CCrCBX023553 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 12 Mar 2010 07:53:12 -0500 Received: from localhost.localdomain (vpn1-5-211.ams2.redhat.com [10.36.5.211]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o2CCrAPp031683 for ; Fri, 12 Mar 2010 07:53:11 -0500 From: Kevin Wolf Date: Fri, 12 Mar 2010 13:52:31 +0100 Message-Id: <1268398351-8113-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PATCH] raw-posix: Better error return values for hdev_create List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Now that we output an error message according to the returned error code in qemu-img, let's return the real error codes. "Input/output error" for everything isn't helpful. Signed-off-by: Kevin Wolf --- block/raw-posix.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/block/raw-posix.c b/block/raw-posix.c index 716c15c..f07d730 100644 --- a/block/raw-posix.c +++ b/block/raw-posix.c @@ -1009,12 +1009,12 @@ static int hdev_create(const char *filename, QEMUOptionParameter *options) fd = open(filename, O_WRONLY | O_BINARY); if (fd < 0) - return -EIO; + return -errno; if (fstat(fd, &stat_buf) < 0) - ret = -EIO; + ret = -errno; else if (!S_ISBLK(stat_buf.st_mode) && !S_ISCHR(stat_buf.st_mode)) - ret = -EIO; + ret = -ENODEV; else if (lseek(fd, 0, SEEK_END) < total_size * 512) ret = -ENOSPC; -- 1.6.6.1