aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Reitz <mreitz@redhat.com>2013-12-20 19:28:20 +0100
committerKevin Wolf <kwolf@redhat.com>2014-01-22 12:07:18 +0100
commitfd0fee34b5ae7699dc558c12ddc3663bdb580060 (patch)
tree441ffe360562c42eab70df30c68fb9e061af1a5e
parent1bf20b8280186299c750018bbfa3b52f4afd71ea (diff)
qemu-io: Make filename optional
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 <mreitz@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-rw-r--r--qemu-io.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/qemu-io.c b/qemu-io.c
index bfb773e70f..d6690289b8 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)