]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Fix (and make consistent) the use of OpenBSD preprocessor macro tests
authorKris Katterjohn <katterjohn@gmail.com>
Sun, 23 Dec 2018 20:51:45 +0000 (14:51 -0600)
committerNick Mathewson <nickm@torproject.org>
Wed, 9 Jan 2019 13:51:57 +0000 (08:51 -0500)
Prior to this commit, the testsuite was failing on OpenBSD.  After
this commit the testsuite runs fine on OpenBSD.

It was previously decided to test for the OpenBSD macro (rather than
__OpenBSD__, etc.) because OpenBSD forks seem to have the former
macro defined.  sys/param.h must be included for the OpenBSD macro
definition; however, many files tested for the OpenBSD macro without
having this header included.

This commit includes sys/param.h in the files where the OpenBSD macro
is used (and sys/param.h is not already included), and it also
changes some instances of the __OpenBSD__ macro to OpenBSD.

See commit 27df23abb675ffeb198bf0c1cc85c4baed77a988 which changed
everything to use OpenBSD instead of __OpenBSD__ or OPENBSD.  See
also tickets #6982 and #20980 (the latter ticket is where it was
decided to use the OpenBSD macro).

Signed-off-by: Kris Katterjohn <katterjohn@gmail.com>
src/app/config/config.c
src/core/or/connection_edge.c
src/ext/byteorder.h
src/ext/ed25519/donna/ed25519-donna-portable-identify.h
src/ext/trunnel/trunnel.c
src/lib/err/backtrace.c
src/lib/net/inaddr_st.h
src/test/test-memwipe.c
src/test/test_options.c

index 4a8f94da0e2098f67a704dc79c4813dbc66b1fa5..c71ed018439febed3e009fc01884fb30e71a9302 100644 (file)
 #ifdef HAVE_SYS_STAT_H
 #include <sys/stat.h>
 #endif
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
index 58aefcf8f297975f33761bf1385aa7b515f0aabb..2ec83c120489bc12fb9d8699597e668993a5a63f 100644 (file)
 #ifdef HAVE_SYS_IOCTL_H
 #include <sys/ioctl.h>
 #endif
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
 
 #if defined(HAVE_NET_IF_H) && defined(HAVE_NET_PFVAR_H)
 #include <net/if.h>
index c8ba52184b7976041e49f5f02d475e50c0bf5360..95e080b14d70df38811f91c439304802dbc884dc 100644 (file)
     Jean-Philippe Aumasson (https://131002.net/siphash/siphash24.c)
 */
 
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+
 /* This code is extracted from csiphash.h */
 
 #if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) &&      \
index 26a264cf9ed7a74fb685c73ca98387fcd3792a53..3e0f9cfc502eed2ca077c916182b7112136de4d8 100644 (file)
@@ -14,7 +14,7 @@
                        #define OS_OSX
                #elif defined(macintosh) || defined(Macintosh)
                        #define OS_MAC
-               #elif defined(__OpenBSD__)
+               #elif defined(OpenBSD)
                        #define OS_OPENBSD
                #endif
        #endif
index b749d8136f56337230726093a989beb699a7a236..2442bc3909f937d38665cd0390e2872e4fb92ee6 100644 (file)
 #include <stdlib.h>
 #include <string.h>
 
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+
 #if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && \
        __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
 #  define IS_LITTLE_ENDIAN 1
@@ -31,7 +35,7 @@
 #    define IS_LITTLE_ENDIAN
 #  endif
 #else
-# if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
+# if defined(__FreeBSD__) || defined(__NetBSD__) || defined(OpenBSD)
 #  include <sys/endian.h>
 # else
 #  include <endian.h>
index d18a595c34a5717c20bba80382b936e1bc43e8a6..b568c888c52ff10ce1b65d73bcca3cd4a31dc887 100644 (file)
@@ -32,6 +32,9 @@
 #ifdef HAVE_SIGNAL_H
 #include <signal.h>
 #endif
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
 #include <errno.h>
 #include <stdlib.h>
 #include <string.h>
index dc4c6e3a003c54e4a0d6a2f3e413c0a0d10d2550..a6b7796268fc32f9661c355aa4c41536fd853f93 100644 (file)
@@ -28,6 +28,9 @@
 #ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
 #endif
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
 
 #ifdef _WIN32
 #include <winsock2.h>
@@ -60,7 +63,7 @@ struct in6_addr
 /** @{ */
 /** Many BSD variants seem not to define these. */
 #if defined(__APPLE__) || defined(__darwin__) || \
-  defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
+  defined(__FreeBSD__) || defined(__NetBSD__) || defined(OpenBSD)
 #ifndef s6_addr16
 #define s6_addr16 __u6_addr.__u6_addr16
 #endif
index c879013ed650fd7c338a2ce551dd63b8c0d73cf2..b00e854a1c4033b6a243ed12435559a9ecd22262 100644 (file)
 #include <sys/types.h>
 #include <stdlib.h>
 
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+
 static unsigned fill_a_buffer_memset(void) __attribute__((noinline));
 static unsigned fill_a_buffer_memwipe(void) __attribute__((noinline));
 static unsigned fill_a_buffer_nothing(void) __attribute__((noinline));
index f14e620eeb21791a186e23b919ad6a595ebb4853..dd24ff441045559e4abca4a35789e2b4aefa1f9b 100644 (file)
 #include "test/test_helpers.h"
 #include "lib/net/resolve.h"
 
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+
 #define NS_MODULE test_options
 
 typedef struct {