From 57e69b7d4e270883c7b7adb9c5993bb42e13a5ea Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Fri, 12 Mar 2010 13:52:31 +0100 Subject: raw-posix: Better error return values for hdev_create 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 Reviewed-by: Christoph Hellwig Signed-off-by: Aurelien Jarno --- block/raw-posix.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'block/raw-posix.c') diff --git a/block/raw-posix.c b/block/raw-posix.c index 7ce72e9e4e..ed8db5ed1a 100644 --- a/block/raw-posix.c +++ b/block/raw-posix.c @@ -993,12 +993,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; -- cgit v1.2.3