From: Jens Axboe Date: Tue, 19 Mar 2013 16:47:15 +0000 (-0600) Subject: lib/getopt_long: clear 'optarg' every time X-Git-Tag: fio-2.0.15~22 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=25c42559e065f5a94a696b7bbefa32426d7b8925;p=fio.git lib/getopt_long: clear 'optarg' every time We don't want a stale optarg argument to be available. Signed-off-by: Jens Axboe --- 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