qemu-io: Don't print NULL when open without non-option arg fails

Reproducer: "open -o a=b".  Broken in commit fd0fee3.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
Markus Armbruster 2014-05-28 11:17:00 +02:00 committed by Kevin Wolf
parent 29f2601aa6
commit 543f7bef13
1 changed files with 4 additions and 2 deletions

View File

@ -62,7 +62,8 @@ static int openfile(char *name, int flags, int growable, QDict *opts)
if (bdrv_open(&qemuio_bs, name, NULL, opts, flags | BDRV_O_PROTOCOL,
NULL, &local_err))
{
fprintf(stderr, "%s: can't open device %s: %s\n", progname, name,
fprintf(stderr, "%s: can't open%s%s: %s\n", progname,
name ? " device " : "", name ?: "",
error_get_pretty(local_err));
error_free(local_err);
return 1;
@ -73,7 +74,8 @@ static int openfile(char *name, int flags, int growable, QDict *opts)
if (bdrv_open(&qemuio_bs, name, NULL, opts, flags, NULL, &local_err)
< 0)
{
fprintf(stderr, "%s: can't open device %s: %s\n", progname, name,
fprintf(stderr, "%s: can't open%s%s: %s\n", progname,
name ? " device " : "", name ?: "",
error_get_pretty(local_err));
error_free(local_err);
bdrv_unref(qemuio_bs);