qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] raw-posix: Better error return values for hdev_create
@ 2010-03-12 12:52 Kevin Wolf
  2010-03-12 14:01 ` Christoph Hellwig
  2010-03-27 12:34 ` Aurelien Jarno
  0 siblings, 2 replies; 3+ messages in thread
From: Kevin Wolf @ 2010-03-12 12:52 UTC (permalink / raw)
  To: qemu-devel

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>
---
 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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-03-27 12:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-12 12:52 [Qemu-devel] [PATCH] raw-posix: Better error return values for hdev_create Kevin Wolf
2010-03-12 14:01 ` Christoph Hellwig
2010-03-27 12:34 ` Aurelien Jarno

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).