From 54318b8c358e794ef244598bede68ba7d91b3ac7 Mon Sep 17 00:00:00 2001 From: Wouter Wijngaards Date: Thu, 22 May 2008 09:00:56 +0000 Subject: [PATCH] Fix bug #175. git-svn-id: file:///svn/unbound/trunk@1090 be551aaa-1e26-0410-a405-d3ace91eadb9 --- config.h.in | 3 ++ configure | 94 +++++++++++++++++++++++++++++++++++++++++++++++++ configure.ac | 1 + daemon/daemon.c | 4 +++ doc/Changelog | 2 ++ 5 files changed, 104 insertions(+) diff --git a/config.h.in b/config.h.in index 419f9d801..731659c0f 100644 --- a/config.h.in +++ b/config.h.in @@ -151,6 +151,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_TIME_H +/* Define to 1 if you have the `tzset' function. */ +#undef HAVE_TZSET + /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H diff --git a/configure b/configure index 8cd8af4f7..51a3406c3 100755 --- a/configure +++ b/configure @@ -24982,6 +24982,100 @@ done +for ac_func in tzset +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + for ac_func in getaddrinfo do diff --git a/configure.ac b/configure.ac index fa226706d..4bc55b501 100644 --- a/configure.ac +++ b/configure.ac @@ -671,6 +671,7 @@ AC_REPLACE_FUNCS(inet_ntop) AC_REPLACE_FUNCS(snprintf) AC_REPLACE_FUNCS(strlcpy) AC_REPLACE_FUNCS(memmove) +AC_CHECK_FUNCS([tzset]) AC_CHECK_FUNCS([getaddrinfo]) if test $ac_cv_func_getaddrinfo = no; then diff --git a/daemon/daemon.c b/daemon/daemon.c index 48751364a..a31cede91 100644 --- a/daemon/daemon.c +++ b/daemon/daemon.c @@ -130,6 +130,10 @@ daemon_init() signal_handling_record(); checklock_start(); ERR_load_crypto_strings(); +#ifdef HAVE_TZSET + /* init timezone info while we are not chrooted yet */ + tzset(); +#endif daemon->need_to_exit = 0; modstack_init(&daemon->mods); if(!(daemon->env = (struct module_env*)calloc(1, diff --git a/doc/Changelog b/doc/Changelog index 28c75eeda..3e29ea211 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,5 +1,7 @@ 22 May 2008: Wouter - contrib unbound.spec from Patrick Vande Walle. + - fixup bug#175: call tzset before chroot to have correct timestamps + in system log. 19 May 2008: Wouter - fedora 9, check in6_pktinfo define in configure.