Message ID | 1403134317-6817-1-git-send-email-famz@redhat.com |
---|---|
State | New |
Headers | show |
On 06/18/2014 05:31 PM, Fam Zheng wrote: > Reported-by: Milos Vyletel <milos.vyletel@gmail.com> > Signed-off-by: Fam Zheng <famz@redhat.com> > --- > block/raw-posix.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > Chunyan's solution looks better: https://lists.gnu.org/archive/html/qemu-devel/2014-06/msg04104.html
diff --git a/block/raw-posix.c b/block/raw-posix.c index dacf4fb..1f45fd8 100644 --- a/block/raw-posix.c +++ b/block/raw-posix.c @@ -1282,8 +1282,10 @@ static int raw_create(const char *filename, QemuOpts *opts, Error **errp) strstart(filename, "file:", &filename); /* Read out options */ - total_size = - qemu_opt_get_size_del(opts, BLOCK_OPT_SIZE, 0) / BDRV_SECTOR_SIZE; + if (opts) { + total_size = + qemu_opt_get_size_del(opts, BLOCK_OPT_SIZE, 0) / BDRV_SECTOR_SIZE; + } fd = qemu_open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644);
Reported-by: Milos Vyletel <milos.vyletel@gmail.com> Signed-off-by: Fam Zheng <famz@redhat.com> --- block/raw-posix.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)