From 7974f832a0149abef5b981012ec6deba7093ac07 Mon Sep 17 00:00:00 2001 From: Enrico Jorns Date: Mon, 15 May 2017 16:55:37 +0200 Subject: barebox-state: fix termination of long_options[] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From the getopt_long() documentation: | The argument longopts must be an array of these structures, one for each | long option. Terminate the array with an element containing all zeros. Otherwise barebox-state will segfault for unknown options: % ./barebox-state --foo [1] 17946 segmentation fault (core dumped) ./barebox-state --foo Signed-off-by: Enrico Jorns Acked-by: Uwe Kleine-König --- src/barebox-state.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/barebox-state.c b/src/barebox-state.c index 4bd77cf..24e13d2 100644 --- a/src/barebox-state.c +++ b/src/barebox-state.c @@ -391,6 +391,7 @@ static struct option long_options[] = { {"dump-shell", no_argument, 0, OPT_DUMP_SHELL }, {"verbose", no_argument, 0, 'v' }, {"help", no_argument, 0, 'h' }, + { } }; static void usage(char *name) -- cgit v1.2.3