[1/2] qemu-nbd: Fix return value handling of bdrv_open

Submitted by Ryota OZAKI on March 20, 2010, 4:50 a.m.

Details

Message ID 1269060643-3321-1-git-send-email-ozaki.ryota@gmail.com
State New
Headers show

Commit Message

Ryota OZAKI March 20, 2010, 4:50 a.m.
bdrv_open may return -errno so we have to check
if the return value is '< 0', not '== -1'.
---
 qemu-nbd.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Patch hide | download patch | download mbox

diff --git a/qemu-nbd.c b/qemu-nbd.c
index a393583..b89c361 100644
--- a/qemu-nbd.c
+++ b/qemu-nbd.c
@@ -333,7 +333,7 @@  int main(int argc, char **argv)
     if (bs == NULL)
         return 1;
 
-    if (bdrv_open(bs, argv[optind], flags) == -1)
+    if (bdrv_open(bs, argv[optind], flags) < 0)
         return 1;
 
     fd_size = bs->total_sectors * 512;