diff options
author | Kevin Wolf <kwolf@redhat.com> | 2010-03-12 13:52:31 +0100 |
---|---|---|
committer | Aurelien Jarno <aurelien@aurel32.net> | 2010-03-27 12:00:35 +0100 |
commit | 57e69b7d4e270883c7b7adb9c5993bb42e13a5ea (patch) | |
tree | 60b540eed75cd84f9a567403991eb163ccf5e486 | |
parent | 8d533561f6a6f78b00caf138062f174ca6cd55a2 (diff) | |
download | qemu-57e69b7d4e270883c7b7adb9c5993bb42e13a5ea.zip qemu-57e69b7d4e270883c7b7adb9c5993bb42e13a5ea.tar.gz qemu-57e69b7d4e270883c7b7adb9c5993bb42e13a5ea.tar.bz2 |
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 <kwolf@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
-rw-r--r-- | 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 7ce72e9..ed8db5e 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; |