Browse Source

Fix compilation on OSX Sierra (10.12)

Nick Mathewson 7 years ago
parent
commit
1eba088054
3 changed files with 5 additions and 1 deletions
  1. 1 0
      configure.ac
  2. 1 1
      src/common/compat_pthreads.c
  3. 3 0
      src/common/crypto.c

+ 1 - 0
configure.ac

@@ -986,6 +986,7 @@ AC_CHECK_HEADERS(
         sys/mman.h \
         sys/param.h \
         sys/prctl.h \
+	sys/random.h \
         sys/resource.h \
         sys/select.h \
         sys/socket.h \

+ 1 - 1
src/common/compat_pthreads.c

@@ -247,7 +247,7 @@ tor_cond_wait(tor_cond_t *cond, tor_mutex_t *mutex, const struct timeval *tv)
         return -1;
       }
       tvnow.tv_sec = ts.tv_sec;
-      tvnow.tv_usec = ts.tv_nsec / 1000;
+      tvnow.tv_usec = (int)(ts.tv_nsec / 1000);
       timeradd(tv, &tvnow, &tvsum);
 #else
       if (gettimeofday(&tvnow, NULL) < 0)

+ 3 - 0
src/common/crypto.c

@@ -77,6 +77,9 @@
 #ifdef HAVE_SYS_SYSCALL_H
 #include <sys/syscall.h>
 #endif
+#ifdef HAVE_SYS_RANDOM_H
+#include <sys/random.h>
+#endif
 
 #include "torlog.h"
 #include "aes.h"