[igt-dev] [PATCH i-g-t 16/21] lib/igt_core: Assert that optarg is present

Petri Latvala
2019-01-16T11:21:02Z

If getopt_long is told an argument is required, it will give it.

Signed-off-by: Petri Latvala <petri.latvala@intel.com>
Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
---
lib/igt_core.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/lib/igt_core.c b/lib/igt_core.c
index 7c727edc..26dd2789 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -760,6 +760,7 @@ static int common_init(int *argc, char **argv,
list_subtests = true;
break;
case OPT_RUN_SUBTEST:
+ assert(optarg);
if (!list_subtests)
run_single_subtest = strdup(optarg);
break;
--
2.19.1