From 25c42559e065f5a94a696b7bbefa32426d7b8925 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Tue, 19 Mar 2013 10:47:15 -0600 Subject: [PATCH 1/1] lib/getopt_long: clear 'optarg' every time We don't want a stale optarg argument to be available. Signed-off-by: Jens Axboe --- lib/getopt_long.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/getopt_long.c b/lib/getopt_long.c index bdd524ba..11d879ad 100644 --- a/lib/getopt_long.c +++ b/lib/getopt_long.c @@ -46,6 +46,8 @@ int getopt_long_only(int argc, char *const *argv, const char *optstring, const char *osptr; int opt; + optarg = NULL; + /* getopt() relies on a number of different global state variables, which can make this really confusing if there is more than one use of getopt() in the same program. This -- 2.25.1