[Qemu-devel] [PATCH 29/31] vl: Assert drive_new() does not fail in default_drive()
If creating (empty) default drives fails, it's a bug. Therefore, assert() is more appropriate than exit(1). Cc: Kevin Wolf Cc: Max Reitz Signed-off-by: Markus Armbruster --- vl.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/vl.c b/vl.c index 4aa976c4cc..0d25956b2f 100644 --- a/vl.c +++ b/vl.c @@ -1156,9 +1156,7 @@ static void default_drive(int enable, int snapshot, BlockInterfaceType type, } dinfo = drive_new(opts, type); -if (!dinfo) { -exit(1); -} +assert(dinfo); dinfo->is_default = true; } -- 2.17.1
Re: [Qemu-devel] [PATCH 29/31] vl: Assert drive_new() does not fail in default_drive()
On 10/8/18 12:31 PM, Markus Armbruster wrote: If creating (empty) default drives fails, it's a bug. Therefore, assert() is more appropriate than exit(1). Cc: Kevin Wolf Cc: Max Reitz Signed-off-by: Markus Armbruster --- vl.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) The assert disappears in the next patch (replaced by an &error_fatal), but the separation of patches makes sense. Reviewed-by: Eric Blake -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Re: [Qemu-devel] [PATCH 29/31] vl: Assert drive_new() does not fail in default_drive()
On 08.10.18 19:31, Markus Armbruster wrote: > If creating (empty) default drives fails, it's a bug. Therefore, > assert() is more appropriate than exit(1). > > Cc: Kevin Wolf > Cc: Max Reitz > Signed-off-by: Markus Armbruster > --- > vl.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) Reviewed-by: Max Reitz signature.asc Description: OpenPGP digital signature