]> git.proxmox.com Git - qemu.git/commitdiff
raw-posix: Better error return values for hdev_create
authorKevin Wolf <kwolf@redhat.com>
Fri, 12 Mar 2010 12:52:31 +0000 (13:52 +0100)
committerAurelien Jarno <aurelien@aurel32.net>
Sat, 27 Mar 2010 11:00:35 +0000 (12:00 +0100)
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 <kwolf@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
block/raw-posix.c

index 7ce72e9e4e3d6b14868aee1f3492b251da99a319..ed8db5ed1a02e9de8274041b1e8dca5860e91798 100644 (file)
@@ -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;