summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEnrico Jorns <ejo@pengutronix.de>2017-05-15 16:55:37 +0200
committerEnrico Jorns <ejo@pengutronix.de>2017-06-30 07:32:14 +0200
commit7974f832a0149abef5b981012ec6deba7093ac07 (patch)
treeba12b9a1d0dd251b301f8241e26da48b6769e923 /src
parent2992ad0dd173659ea7d0c260051f6bf1d239ef47 (diff)
downloaddt-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>
Diffstat (limited to 'src')
-rw-r--r--src/barebox-state.c1
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)