From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NvVE7-0003St-UW for qemu-devel@nongnu.org; Sat, 27 Mar 2010 08:34:55 -0400 Received: from [140.186.70.92] (port=48228 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NvVE6-0003SZ-FP for qemu-devel@nongnu.org; Sat, 27 Mar 2010 08:34:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NvVE5-0001e8-Aw for qemu-devel@nongnu.org; Sat, 27 Mar 2010 08:34:54 -0400 Received: from hall.aurel32.net ([88.191.82.174]:49024) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NvVE5-0001e1-3U for qemu-devel@nongnu.org; Sat, 27 Mar 2010 08:34:53 -0400 Date: Sat, 27 Mar 2010 13:34:51 +0100 From: Aurelien Jarno Subject: Re: [Qemu-devel] [PATCH] raw-posix: Better error return values for hdev_create Message-ID: <20100327123451.GH15194@volta.aurel32.net> References: <1268398351-8113-1-git-send-email-kwolf@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <1268398351-8113-1-git-send-email-kwolf@redhat.com> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: qemu-devel@nongnu.org On Fri, Mar 12, 2010 at 01:52:31PM +0100, Kevin Wolf wrote: > 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 Thanks, applied. > --- > 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 > > > > -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurelien@aurel32.net http://www.aurel32.net