[tor-commits] [tor/maint-0.2.7] Don't call pthread_condattr_setclock() unless it exists

nickm at torproject.org nickm at torproject.org
Wed Dec 16 14:24:18 UTC 2015


commit 33b5bfb94824a55254f1ffcddf38ac17589a2744
Author: Nick Mathewson <nickm at torproject.org>
Date:   Wed Dec 16 09:23:44 2015 -0500

    Don't call pthread_condattr_setclock() unless it exists
    
    Fixes bug 17819; bugfix on 0.2.6.3-alpha (specifically, d684dbb0).
---
 changes/bug17819             |    4 ++++
 configure.ac                 |    1 +
 src/common/compat_pthreads.c |    3 ++-
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/changes/bug17819 b/changes/bug17819
new file mode 100644
index 0000000..45c55f7
--- /dev/null
+++ b/changes/bug17819
@@ -0,0 +1,4 @@
+  o Minor bugfixes (compilation):
+    - Don't try to use the pthrad_condattr_setclock() function unless
+      it actually exists.  Fixes compilation on NetBSD-6.x. Fixes bug
+      17819; bugfix on 0.2.6.3-alpha.
diff --git a/configure.ac b/configure.ac
index d37c34d..2f75568 100644
--- a/configure.ac
+++ b/configure.ac
@@ -425,6 +425,7 @@ AC_CHECK_FUNCS(
 if test "$bwin32" != true; then
   AC_CHECK_HEADERS(pthread.h)
   AC_CHECK_FUNCS(pthread_create)
+  AC_CHECK_FUNCS(pthread_condattr_setclock)
 fi
 
 if test "$bwin32" = true; then
diff --git a/src/common/compat_pthreads.c b/src/common/compat_pthreads.c
index 4b32fc9..b1d87d3 100644
--- a/src/common/compat_pthreads.c
+++ b/src/common/compat_pthreads.c
@@ -185,7 +185,8 @@ tor_cond_init(tor_cond_t *cond)
     return -1;
   }
 
-#if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC)
+#if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC) \
+  && defined(HAVE_PTHREAD_CONDATTR_SETCLOCK)
   /* Use monotonic time so when we timedwait() on it, any clock adjustment
    * won't affect the timeout value. */
   if (pthread_condattr_setclock(&condattr, CLOCK_MONOTONIC)) {



More information about the tor-commits mailing list