aboutsummaryrefslogtreecommitdiff
path: root/qemu-io.c
diff options
context:
space:
mode:
Diffstat (limited to 'qemu-io.c')
-rw-r--r--qemu-io.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/qemu-io.c b/qemu-io.c
index ffb581734b..8517b909c7 100644
--- a/qemu-io.c
+++ b/qemu-io.c
@@ -1276,23 +1276,23 @@ static int openfile(char *name, int flags, int growable)
return 1;
}
- bs = bdrv_new("hda");
- if (!bs)
- return 1;
-
if (growable) {
- flags |= BDRV_O_FILE;
- }
-
- if (bdrv_open(bs, name, flags, NULL) < 0) {
- fprintf(stderr, "%s: can't open device %s\n", progname, name);
- bs = NULL;
- return 1;
+ if (bdrv_file_open(&bs, name, flags)) {
+ fprintf(stderr, "%s: can't open device %s\n", progname, name);
+ return 1;
+ }
+ } else {
+ bs = bdrv_new("hda");
+ if (!bs)
+ return 1;
+
+ if (bdrv_open(bs, name, flags, NULL) < 0) {
+ fprintf(stderr, "%s: can't open device %s\n", progname, name);
+ bs = NULL;
+ return 1;
+ }
}
- if (growable) {
- bs->growable = 1;
- }
return 0;
}