diff options
author | Enrico Jorns <ejo@pengutronix.de> | 2017-05-15 16:55:37 +0200 |
---|---|---|
committer | Enrico Jorns <ejo@pengutronix.de> | 2017-06-30 07:32:14 +0200 |
commit | 7974f832a0149abef5b981012ec6deba7093ac07 (patch) | |
tree | ba12b9a1d0dd251b301f8241e26da48b6769e923 | |
parent | 2992ad0dd173659ea7d0c260051f6bf1d239ef47 (diff) | |
download | dt-utils-7974f832a0149abef5b981012ec6deba7093ac07.tar.gz dt-utils-7974f832a0149abef5b981012ec6deba7093ac07.tar.xz |
barebox-state: fix termination of long_options[]
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 <ejo@pengutronix.de>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
-rw-r--r-- | src/barebox-state.c | 1 |
1 files changed, 1 insertions, 0 deletions
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) |