qemu-nbd: 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 <ozaki.ryota@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
This commit is contained in:
Ryota Ozaki 2010-03-20 15:23:22 +09:00 committed by Aurelien Jarno
parent bd12ff9df7
commit a16c174c51

View File

@ -333,7 +333,7 @@ int main(int argc, char **argv)
if (bs == NULL) if (bs == NULL)
return 1; return 1;
if (bdrv_open(bs, argv[optind], flags) == -1) if (bdrv_open(bs, argv[optind], flags) < 0)
return 1; return 1;
fd_size = bs->total_sectors * 512; fd_size = bs->total_sectors * 512;