]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Fix compile warnings for printf ll format on mingw compile.
authorW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Wed, 2 Mar 2022 13:34:36 +0000 (14:34 +0100)
committerW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Wed, 2 Mar 2022 13:34:36 +0000 (14:34 +0100)
config.h.in
configure
configure.ac
doc/Changelog
validator/autotrust.c

index 197c2838b33f333a424f5096f6bfc24c8c1f6185..a080dde0da2eb88371160c621ba1ec4537d18a09 100644 (file)
 /* 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
 
 #include <ws2tcpip.h>
 #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"
index b56720f96a5bff28accfd3f09e4eb52559846d64..4b97c2541b1e3e3d26598fa4bfd49112e7fb5a73 100755 (executable)
--- 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
index 9be7f1ee48c60af3875b88d0fa3a544373968ade..ca0c6154fe91a3a96aeeb4c1e7eb0c1624e9cb2c 100644 (file)
@@ -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 <ws2tcpip.h>
 #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"
index b3311201be10891661719d18239d1a8d3e77e730..ff410c21289d4d81b2c53c46190107289cf1997f 100644 (file)
@@ -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.
 
index ec656a1bd4fbd90bad74eb9baf526ceecee5696b..96776a1f53b46840c4bb90df84b5837e9e235e34 100644 (file)
@@ -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");