[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Use the standard OpenBSD preprocessor definition



commit 27df23abb675ffeb198bf0c1cc85c4baed77a988
Author: cypherpunks <cypherpunks@xxxxxxxxxxxxxx>
Date:   Thu Sep 1 17:50:38 2016 +0000

    Use the standard OpenBSD preprocessor definition
---
 changes/bug20980          | 4 ++++
 configure.ac              | 4 ----
 src/common/backtrace.c    | 2 +-
 src/common/torgzip.c      | 2 +-
 src/common/util.c         | 2 +-
 src/ext/csiphash.c        | 4 ++--
 src/ext/trunnel/trunnel.c | 2 +-
 src/or/config.c           | 2 +-
 src/or/connection_edge.c  | 2 +-
 src/or/directory.c        | 2 +-
 src/test/test-memwipe.c   | 2 +-
 src/test/test_options.c   | 4 ++--
 12 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/changes/bug20980 b/changes/bug20980
new file mode 100644
index 0000000..362a753
--- /dev/null
+++ b/changes/bug20980
@@ -0,0 +1,4 @@
+  o Minor bugfix (OpenBSD):
+    - Use "OpenBSD" pre-defined compiler macro instead of "OPENBSD" or
+      "__OpenBSD__". It is supported by OpenBSD itself and also most OpenBSD
+      variants like Bitrig. Fixes bug 20980.
diff --git a/configure.ac b/configure.ac
index 669dc37..bad21e3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1150,10 +1150,6 @@ if test "x$linux_netfilter_ipv6_ip6_tables" = "x1"; then
 fi
 if test "x$transparent_ok" = "x1"; then
   AC_DEFINE(USE_TRANSPARENT, 1, "Define to enable transparent proxy support")
-  case "$host" in
-    *-*-openbsd* | *-*-bitrig*)
-      AC_DEFINE(OPENBSD, 1, "Define to handle pf on OpenBSD properly") ;;
-  esac
 else
   AC_MSG_NOTICE([Transparent proxy support enabled, but missing headers.])
 fi
diff --git a/src/common/backtrace.c b/src/common/backtrace.c
index 81e04e9..6109695 100644
--- a/src/common/backtrace.c
+++ b/src/common/backtrace.c
@@ -76,7 +76,7 @@ clean_backtrace(void **stack, size_t depth, const ucontext_t *ctx)
 #ifdef PC_FROM_UCONTEXT
 #if defined(__linux__)
   const size_t n = 1;
-#elif defined(__darwin__) || defined(__APPLE__) || defined(__OpenBSD__) \
+#elif defined(__darwin__) || defined(__APPLE__) || defined(OpenBSD) \
   || defined(__FreeBSD__)
   const size_t n = 2;
 #else
diff --git a/src/common/torgzip.c b/src/common/torgzip.c
index 3353f0e..04ae353 100644
--- a/src/common/torgzip.c
+++ b/src/common/torgzip.c
@@ -206,7 +206,7 @@ tor_gzip_compress(char **out, size_t *out_len,
   }
  done:
   *out_len = stream->total_out;
-#ifdef OPENBSD
+#if defined(OpenBSD)
   /* "Hey Rocky!  Watch me change an unsigned field to a signed field in a
    *    third-party API!"
    * "Oh, that trick will just make people do unsafe casts to the unsigned
diff --git a/src/common/util.c b/src/common/util.c
index 824b4fb..180712a 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -79,7 +79,7 @@
 #include <malloc/malloc.h>
 #endif
 #ifdef HAVE_MALLOC_H
-#if !defined(OPENBSD) && !defined(__FreeBSD__)
+#if !defined(OpenBSD) && !defined(__FreeBSD__)
 /* OpenBSD has a malloc.h, but for our purposes, it only exists in order to
  * scold us for being so stupid as to autodetect its presence.  To be fair,
  * they've done this since 1996, when autoconf was only 5 years old. */
diff --git a/src/ext/csiphash.c b/src/ext/csiphash.c
index b60f73a..8348c66 100644
--- a/src/ext/csiphash.c
+++ b/src/ext/csiphash.c
@@ -53,7 +53,7 @@
 #else
 
 /* See: http://sourceforge.net/p/predef/wiki/Endianness/ */
-#  if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
+#  if defined(__FreeBSD__) || defined(__NetBSD__) || defined(OpenBSD)
 #    include <sys/endian.h>
 #  else
 #    include <endian.h>
@@ -62,7 +62,7 @@
 	__BYTE_ORDER == __LITTLE_ENDIAN
 #    define _le64toh(x) ((uint64_t)(x))
 #  else
-#    if defined(__OpenBSD__)
+#    if defined(OpenBSD)
 #      define _le64toh(x) letoh64(x)
 #    else
 #      define _le64toh(x) le64toh(x)
diff --git a/src/ext/trunnel/trunnel.c b/src/ext/trunnel/trunnel.c
index a008fb9..8f72351 100644
--- a/src/ext/trunnel/trunnel.c
+++ b/src/ext/trunnel/trunnel.c
@@ -31,7 +31,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>
diff --git a/src/or/config.c b/src/or/config.c
index 8016282..e979930 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -3086,7 +3086,7 @@ options_validate(or_options_t *old_options, or_options_t *options,
     if (!strcasecmp(options->TransProxyType, "default")) {
       options->TransProxyType_parsed = TPT_DEFAULT;
     } else if (!strcasecmp(options->TransProxyType, "pf-divert")) {
-#if !defined(__OpenBSD__) && !defined( DARWIN )
+#if !defined(OpenBSD) && !defined( DARWIN )
       /* Later versions of OS X have pf */
       REJECT("pf-divert is a OpenBSD-specific "
              "and OS X/Darwin-specific feature.");
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index 82d5d3c..ef55104 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -1959,7 +1959,7 @@ get_pf_socket(void)
   if (pf_socket >= 0)
     return pf_socket;
 
-#ifdef OPENBSD
+#if defined(OpenBSD)
   /* only works on OpenBSD */
   pf = tor_open_cloexec("/dev/pf", O_RDONLY, 0);
 #else
diff --git a/src/or/directory.c b/src/or/directory.c
index 4c94fe4..93dc488 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -39,7 +39,7 @@
 #include "shared_random.h"
 
 #if defined(EXPORTMALLINFO) && defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO)
-#ifndef OPENBSD
+#if !defined(OpenBSD)
 #include <malloc.h>
 #endif
 #endif
diff --git a/src/test/test-memwipe.c b/src/test/test-memwipe.c
index 2188244..d3f2dc0 100644
--- a/src/test/test-memwipe.c
+++ b/src/test/test-memwipe.c
@@ -36,7 +36,7 @@ const char *s = NULL;
     sum += (unsigned char)buf[i];                                       \
   }
 
-#ifdef __OpenBSD__
+#ifdef OpenBSD
 /* Disable some of OpenBSD's malloc protections for this test. This helps
  * us do bad things, such as access freed buffers, without crashing. */
 const char *malloc_options="sufjj";
diff --git a/src/test/test_options.c b/src/test/test_options.c
index e822404..d5782e9 100644
--- a/src/test/test_options.c
+++ b/src/test/test_options.c
@@ -1022,7 +1022,7 @@ test_options_validate__transproxy(void *ignored)
   ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
   tt_int_op(ret, OP_EQ, -1);
 
-#if !defined(__OpenBSD__) && !defined( DARWIN )
+#if !defined(OpenBSD) && !defined( DARWIN )
   tt_str_op(msg, OP_EQ,
           "pf-divert is a OpenBSD-specific and OS X/Darwin-specific feature.");
 #else
@@ -1091,7 +1091,7 @@ test_options_validate__transproxy(void *ignored)
   if (msg) {
     TT_DIE(("Expected NULL but got '%s'", msg));
   }
-#elif defined(__OpenBSD__)
+#elif defined(OpenBSD)
   tdata = get_options_test_data("TransProxyType pf-divert\n"
                                 "TransPort 127.0.0.1:123\n");
   ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits