qemu-io: Fix return value handling of bdrv_open
PATCH 1/1 qemu-io: Fix return value handling of bdrv_open
bdrv_open may return -errno so we have to check
if the return value is '< 0', not '== -1'.
Signed-off-by Ryota Ozaki <[email protected]>
--- qemu-io.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
qemu-io.c +1 -1
@@ -1284,7 +1284,7 @@ static int openfile(char *name, int flags, int growable) flags |=BDRV_O_FILE ; } -if (bdrv_open (bs, name, flags) ==-1 ) { +if (bdrv_open (bs, name, flags) <0 ) {fprintf (stderr,"%s: can't open device %s\n" , progname, name); bs =NULL ;return 1 ;
Signature · 1 line
1.6.5.2
Quoted 2 lines · Ryota Ozaki
bdrv_openmay return -errno so we have to check
if the return value is '< 0', not '== -1'.
Looks good, thanks!
Aurelien Jarno
AppliedQuoted 2 lines · Ryota Ozaki
bdrv_openmay return -errno so we have to check
if the return value is '< 0', not '== -1'.
Thanks, applied.
Quoted 24 lines
Signed-off-by Ryota Ozaki <[email protected]>--- qemu-io.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)qemu-io.c +1
-1@@ -1284,7 +1284,7 @@ static int openfile(char *name, int flags, int growable) flags |=BDRV_O_FILE ; } -if (bdrv_open (bs, name, flags) ==-1 ) { +if (bdrv_open (bs, name, flags) <0 ) {fprintf (stderr,"%s: can't open device %s\n" , progname, name); bs =NULL ;return 1 ;Signature · 1 line
1.6.5.2
Signature · 2 lines
Aurelien Jarno GPG: 1024D/F1BCDB73 [email protected] http://www.aurel32.net