summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac2
-rw-r--r--src/libopts/makeshell.c4
2 files changed, 4 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index 645940300a..21b76fced9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -206,7 +206,7 @@ AC_PROG_LIBTOOL
dnl No fork on MinGW, disable some self-tests until we fix them.
dnl Check clock_gettime and pthread_mutex_lock in libc (avoid linking to other libs)
-AC_CHECK_FUNCS([fork getrusage getpwuid_r nanosleep daemon getpid clock_gettime pthread_mutex_lock iconv],,)
+AC_CHECK_FUNCS([fork getrusage getpwuid_r nanosleep daemon getpid clock_gettime pthread_mutex_lock iconv localtime],,)
AM_CONDITIONAL(HAVE_FORK, test "$ac_cv_func_fork" != "no")
if test "$ac_cv_func_pthread_mutex_lock" != "yes";then
diff --git a/src/libopts/makeshell.c b/src/libopts/makeshell.c
index f22e9f0b84..d5a8b82fe6 100644
--- a/src/libopts/makeshell.c
+++ b/src/libopts/makeshell.c
@@ -345,7 +345,7 @@ text_to_var(tOptions * opts, teTextTo which, tOptDesc * od)
static void
emit_usage(tOptions * opts)
{
- char tm_nm_buf[AO_NAME_SIZE];
+ char tm_nm_buf[AO_NAME_SIZE] = "";
/*
* First, switch stdout to the output file name.
@@ -359,11 +359,13 @@ emit_usage(tOptions * opts)
{
char const * out_nm;
+#ifdef HAVE_LOCALTIME
{
time_t c_tim = time(NULL);
struct tm * ptm = localtime(&c_tim);
strftime(tm_nm_buf, AO_NAME_SIZE, TIME_FMT, ptm );
}
+#endif
if (HAVE_GENSHELL_OPT(SCRIPT))
out_nm = GENSHELL_OPT_ARG(SCRIPT);