From: Lucas De Marchi Date: Wed, 3 Jan 2018 21:37:59 +0000 (-0800) Subject: testsuite: add missing error handling X-Git-Tag: v25~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=568b1c86cc4873c03c2df1c14cdf6dc4acfdc896;p=thirdparty%2Fkmod.git testsuite: add missing error handling If we passed an invalid argument to a test it would segfault rather than returning an error code. --- diff --git a/testsuite/testsuite.h b/testsuite/testsuite.h index bb0eb507..2b314833 100644 --- a/testsuite/testsuite.h +++ b/testsuite/testsuite.h @@ -151,6 +151,8 @@ int test_run(const struct test *t); arg = test_init(__start_kmod_tests, __stop_kmod_tests, argc, argv); \ if (arg == 0) \ return 0; \ + if (arg < 0) \ + return EXIT_FAILURE; \ \ if (arg < argc) { \ t = test_find(__start_kmod_tests, __stop_kmod_tests, argv[arg]); \