From 5be4c944e83b32c0c6842130df3dc1d46cd6eb1f Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Mon, 11 Feb 2013 16:33:25 +0100 Subject: [PATCH] Initialize global and non-static variables Don't assume they get zeroed. The AIX linker throws a hissy fit on these, refusing to link the program. Signed-off-by: Jens Axboe --- fio.c | 4 ++-- gettime-thread.c | 2 +- init.c | 2 +- lib/getopt_long.c | 5 +++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/fio.c b/fio.c index af4c12cb..60261ffa 100644 --- a/fio.c +++ b/fio.c @@ -28,8 +28,8 @@ #include "fio.h" #include "smalloc.h" -uintptr_t page_mask; -uintptr_t page_size; +uintptr_t page_mask = 0; +uintptr_t page_size = 0; static int endian_check(void) { diff --git a/gettime-thread.c b/gettime-thread.c index c1b4b096..3d49034a 100644 --- a/gettime-thread.c +++ b/gettime-thread.c @@ -6,7 +6,7 @@ #include "fio.h" #include "smalloc.h" -struct timeval *fio_tv; +struct timeval *fio_tv = NULL; int fio_gtod_offload = 0; int fio_gtod_cpu = -1; static pthread_t gtod_thread; diff --git a/init.c b/init.c index e8f3a9bb..4709ff29 100644 --- a/init.c +++ b/init.c @@ -40,7 +40,7 @@ struct thread_data *threads = NULL; int exitall_on_terminate = 0; int output_format = FIO_OUTPUT_NORMAL; -int eta_print; +int eta_print = FIO_ETA_AUTO; unsigned long long mlock_size = 0; FILE *f_out = NULL; FILE *f_err = NULL; diff --git a/lib/getopt_long.c b/lib/getopt_long.c index 70894e32..bdd524ba 100644 --- a/lib/getopt_long.c +++ b/lib/getopt_long.c @@ -16,8 +16,9 @@ #include "getopt.h" -char *optarg; -int optind, opterr, optopt; +char *optarg = NULL; +int optind = 0, opterr = 0, optopt = 0; + static struct getopt_private_state { const char *optptr; const char *last_optstring; -- 2.25.1