qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PULL 37/42] qemu-io: Make filename optional


From: Kevin Wolf
Subject: [Qemu-devel] [PULL 37/42] qemu-io: Make filename optional
Date: Wed, 15 Jan 2014 11:22:50 +0100

From: Max Reitz <address@hidden>

Giving a filename is actually not essential, since it can be specified
through the options as well - on the contrary: Sometimes a filename must
not be given.

Signed-off-by: Max Reitz <address@hidden>
Reviewed-by: Kevin Wolf <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
 qemu-io.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/qemu-io.c b/qemu-io.c
index bfb773e..d669028 100644
--- a/qemu-io.c
+++ b/qemu-io.c
@@ -163,11 +163,13 @@ static int open_f(BlockDriverState *bs, int argc, char 
**argv)
         flags |= BDRV_O_RDWR;
     }
 
-    if (optind != argc - 1) {
+    if (optind == argc - 1) {
+        return openfile(argv[optind], flags, growable, opts);
+    } else if (optind == argc) {
+        return openfile(NULL, flags, growable, opts);
+    } else {
         return qemuio_command_usage(&open_cmd);
     }
-
-    return openfile(argv[optind], flags, growable, opts);
 }
 
 static int quit_f(BlockDriverState *bs, int argc, char **argv)
-- 
1.8.1.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]