From: W.C.A. Wijngaards Date: Wed, 2 Mar 2022 13:34:36 +0000 (+0100) Subject: - Fix compile warnings for printf ll format on mingw compile. X-Git-Tag: release-1.16.0rc1~31 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f81420d77fde09b81e94bdfb443bb192336b2e6a;p=thirdparty%2Funbound.git - Fix compile warnings for printf ll format on mingw compile. --- diff --git a/config.h.in b/config.h.in index 197c2838b..a080dde0d 100644 --- a/config.h.in +++ b/config.h.in @@ -971,6 +971,10 @@ /* Define to 1 if you need to in order for `stat' and other things to work. */ #undef _POSIX_SOURCE +/* defined to use gcc ansi snprintf and sscanf that understands %lld when + compiled for windows. */ +#undef __USE_MINGW_ANSI_STDIO + /* Define to empty if `const' does not conform to ANSI C. */ #undef const @@ -1150,7 +1154,7 @@ #include #endif -#ifndef USE_WINSOCK +#if !defined(USE_WINSOCK) || !defined(HAVE_SNPRINTF) || defined(SNPRINTF_RET_BROKEN) || defined(__USE_MINGW_ANSI_STDIO) #define ARG_LL "%ll" #else #define ARG_LL "%I64" diff --git a/configure b/configure index b56720f96..4b97c2541 100755 --- a/configure +++ b/configure @@ -813,6 +813,7 @@ infodir docdir oldincludedir includedir +runstatedir localstatedir sharedstatedir sysconfdir @@ -964,6 +965,7 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' @@ -1216,6 +1218,15 @@ do | -silent | --silent | --silen | --sile | --sil) silent=yes ;; + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst | --runs \ + | --run | --ru | --r) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ + | --run=* | --ru=* | --r=*) + runstatedir=$ac_optarg ;; + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1353,7 +1364,7 @@ fi for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir + libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1506,6 +1517,7 @@ Fine tuning of the installation directories: --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] @@ -20182,6 +20194,9 @@ fi WIN_CHECKCONF_OBJ_LINK="rsrc_unbound_checkconf.o" + +$as_echo "#define __USE_MINGW_ANSI_STDIO 1" >>confdefs.h + fi if test $ac_cv_func_getaddrinfo = no; then case " $LIBOBJS " in diff --git a/configure.ac b/configure.ac index 9be7f1ee4..ca0c6154f 100644 --- a/configure.ac +++ b/configure.ac @@ -1554,6 +1554,7 @@ if test "$USE_WINSOCK" = 1; then AC_SUBST(WIN_CONTROL_OBJ_LINK) WIN_CHECKCONF_OBJ_LINK="rsrc_unbound_checkconf.o" AC_SUBST(WIN_CHECKCONF_OBJ_LINK) + AC_DEFINE(__USE_MINGW_ANSI_STDIO, 1, [defined to use gcc ansi snprintf and sscanf that understands %lld when compiled for windows.]) fi if test $ac_cv_func_getaddrinfo = no; then AC_LIBOBJ([fake-rfc2553]) @@ -2061,7 +2062,7 @@ dnl includes #include #endif -#ifndef USE_WINSOCK +#if !defined(USE_WINSOCK) || !defined(HAVE_SNPRINTF) || defined(SNPRINTF_RET_BROKEN) || defined(__USE_MINGW_ANSI_STDIO) #define ARG_LL "%ll" #else #define ARG_LL "%I64" diff --git a/doc/Changelog b/doc/Changelog index b3311201b..ff410c212 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -3,6 +3,9 @@ - Various fixes for #632: variable initialisation, convert the qinfo to str once, accept trailing dot in the local-zone ipset option. +2 March 2022: Wouter + - Fix compile warnings for printf ll format on mingw compile. + 1 March 2022: Wouter - Fix pythonmod for change in iter_dp_is_useless function prototype. diff --git a/validator/autotrust.c b/validator/autotrust.c index ec656a1bd..96776a1f5 100644 --- a/validator/autotrust.c +++ b/validator/autotrust.c @@ -1203,13 +1203,8 @@ void autr_write_file(struct module_env* env, struct trust_anchor* tp) #else llvalue = (unsigned long long)tp; #endif -#ifndef USE_WINSOCK - snprintf(tempf, sizeof(tempf), "%s.%d-%d-%llx", fname, (int)getpid(), + snprintf(tempf, sizeof(tempf), "%s.%d-%d-" ARG_LL "x", fname, (int)getpid(), env->worker?*(int*)env->worker:0, llvalue); -#else - snprintf(tempf, sizeof(tempf), "%s.%d-%d-%I64x", fname, (int)getpid(), - env->worker?*(int*)env->worker:0, llvalue); -#endif #endif /* S_SPLINT_S */ verbose(VERB_ALGO, "autotrust: write to disk: %s", tempf); out = fopen(tempf, "w");