[tor-commits] [torsocks/master] Fix: nullify constant that might be undefined

dgoulet at torproject.org dgoulet at torproject.org
Fri Apr 4 22:40:28 UTC 2014


commit 62dab5b2ca9fc1a5e92d07feabf70851420de371
Author: David Goulet <dgoulet at ev0ke.net>
Date:   Mon Mar 31 20:08:33 2014 -0400

    Fix: nullify constant that might be undefined
    
    Signed-off-by: David Goulet <dgoulet at ev0ke.net>
---
 src/common/compat.h |   13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/common/compat.h b/src/common/compat.h
index 87191f0..bda18f0 100644
--- a/src/common/compat.h
+++ b/src/common/compat.h
@@ -108,6 +108,19 @@ void tsocks_mutex_unlock(tsocks_mutex_t *m);
 #define TSOCKS_ANY6         { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }
 
 /*
+ * Both socket flags here are defined on some BSD and Linux but not on OS X so
+ * simply nullify them. Include socket.h so the constants are defined before we
+ * test them.
+ */
+#include <sys/socket.h>
+#ifndef SOCK_CLOEXEC
+#define SOCK_CLOEXEC 0
+#endif
+#ifndef SOCK_NONBLOCK
+#define SOCK_NONBLOCK 0
+#endif
+
+/*
  * Macro to tell if a given socket type is a SOCK_STREAM or not. The macro
  * resolve to 1 if yes else 0.
  */





More information about the tor-commits mailing list