]> granicus.if.org Git - pdns/commitdiff
Add lgtm annotations and #error directives if we're configured wrongly.
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Wed, 25 Sep 2019 08:00:47 +0000 (10:00 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Wed, 25 Sep 2019 09:09:55 +0000 (11:09 +0200)
Already showing its worth: a few ac checks were missing.

configure.ac
ext/yahttp/yahttp/utility.hpp
pdns/dnsdistdist/configure.ac
pdns/recursordist/configure.ac

index 1546caf433f60bce9f4c147e8639ec72efc7c637..78a5d88ee36c621074e6342f167d982ef52aa3b4 100644 (file)
@@ -130,7 +130,9 @@ PDNS_CHECK_VIRTUALENV
 PDNS_FROM_GIT
 
 dnl Checks for library functions.
-AC_CHECK_FUNCS_ONCE([strcasestr localtime_r recvmmsg sched_setscheduler getrandom arc4random])
+dnl the *_r functions are in posix so we can use them unconditionally, but the ext/yahttp code is
+dnl using the defines.
+AC_CHECK_FUNCS_ONCE([strcasestr localtime_r gmtime_r recvmmsg sched_setscheduler getrandom arc4random])
 
 AM_CONDITIONAL([HAVE_RECVMMSG], [test "x$ac_cv_func_recvmmsg" = "xyes"])
 
index 8a93ae6d43dc090e612370e0dd82de9ec3f65876..3e8920a1c9fa0b98ba07720c39312bb726b014d3 100644 (file)
@@ -70,7 +70,8 @@ namespace YaHTTP {
        fromTm(&tm);
 #else
        struct tm *tm;
-       tm = localtime(&t);
+       #error define HAVE_LOCALTIME_R
+       tm = localtime(&t); // lgtm [cpp/potentially-dangerous-function]
        fromTm(tm);
 #endif
 #ifndef HAVE_TM_GMTOFF
@@ -79,7 +80,8 @@ namespace YaHTTP {
        gmtime_r(&t, &tm);
        t2 = mktime(&tm);
 # else
-       tm = gmtime(&t);
+       #error define HAVE_LOCALTIME_R
+       tm = gmtime(&t); // lgtm [cpp/potentially-dangerous-function]
        t2 = mktime(tm);
 # endif
        this->utc_offset = ((t2-t)/10)*10; // removes any possible differences. 
@@ -93,7 +95,8 @@ namespace YaHTTP {
        fromTm(&tm);
 #else
        struct tm *tm;
-       tm = gmtime(&t);
+       #error define HAVE_GMTIME_R
+       tm = gmtime(&t);// lgtm [cpp/potentially-dangerous-function]
        fromTm(tm);
 #endif
 #ifndef HAVE_TM_GMTOFF
index 544a9bb1b316d44bfb63ffe23eed97cdb2fbc046..88eabe39dbb6ca2d2e42101b8842480cff36c9de 100644 (file)
@@ -48,6 +48,9 @@ AX_AVAILABLE_SYSTEMD
 AX_CHECK_SYSTEMD_FEATURES
 AM_CONDITIONAL([HAVE_SYSTEMD], [ test x"$systemd" = "xy" ])
 
+dnl the *_r functions are in posix so we can use them unconditionally, but the ext/yahttp code is
+dnl using the defines.
+AC_CHECK_FUNCS_ONCE([localtime_r gmtime_r])
 AC_SUBST([YAHTTP_CFLAGS], ['-I$(top_srcdir)/ext/yahttp'])
 AC_SUBST([YAHTTP_LIBS], ['$(top_builddir)/ext/yahttp/yahttp/libyahttp.la'])
 AC_SUBST([IPCRYPT_CFLAGS], ['-I$(top_srcdir)/ext/ipcrypt'])
index a2c14cc5b8c063b5ae4bbc2e08cc11c9ce2ac98e..6d05754ba880118fb71440c6b19f3370c9ffc382 100644 (file)
@@ -93,7 +93,9 @@ PDNS_WITH_NET_SNMP
 PDNS_CHECK_RAGEL([pdns/dnslabeltext.cc], [www.powerdns.com])
 PDNS_CHECK_CURL
 
-AC_CHECK_FUNCS_ONCE([strcasestr getrandom arc4random])
+dnl the *_r functions are in posix so we can use them unconditionally, but the ext/yahttp code is
+dnl using the defines.
+AC_CHECK_FUNCS_ONCE([localtime_r gmtime_r strcasestr getrandom arc4random])
 
 PDNS_CHECK_PTHREAD_NP