From b2df42dd8aae1dbcbd8a62503dad039596fbfc20 Mon Sep 17 00:00:00 2001 From: Cheng Li <72431553+chengli-rutgers@users.noreply.github.com> Date: Tue, 13 Oct 2020 10:03:12 -0700 Subject: [PATCH] getopt_long: avoid variable global initialization Issue #1100 shows that an address sanitizer(ASAN) complains about a few global variables that are initialized globally in the getopt_long.c file. We look into these variables and found they do not need to be initialized globally. This patch fixes the issue by cleaning up the global initialization for these variables. Fixes https://github.com/axboe/fio/issues/1100 Signed-off-by: Cheng Li --- oslib/getopt_long.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/oslib/getopt_long.c b/oslib/getopt_long.c index 8ec77413..463919fb 100644 --- a/oslib/getopt_long.c +++ b/oslib/getopt_long.c @@ -16,8 +16,8 @@ #include "getopt.h" -char *optarg = NULL; -int optind = 0, opterr = 0, optopt = 0; +char *optarg; +int optind, opterr, optopt; static struct getopt_private_state { const char *optptr; -- 2.25.1