summaryrefslogtreecommitdiff
path: root/arc4random.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2010-02-18 00:54:44 -0500
committerNick Mathewson <nickm@torproject.org>2010-02-18 00:54:44 -0500
commitff2a134d6e2ab74f2aa3eb5832128478202dd137 (patch)
tree7bade3cbf93ede9dd6574ffb041e103611ec77c9 /arc4random.c
parentcb52838fc501b1c18eec6bad367d29e87654d45b (diff)
downloadlibevent-ff2a134d6e2ab74f2aa3eb5832128478202dd137.tar.gz
Fix getpid() usage on Windows
On Windows, getpid() is _getpid(), and requires that we first include <process.h>. arc4random.c previously didn't know that. Actually, I question whether arc4random needs to do its getpid() tricks on Windows. They exist only so that we remember to re-seed the ARC4 cipher whenever we fork... but Windows has no fork(), so I think we're in the clear.
Diffstat (limited to 'arc4random.c')
-rw-r--r--arc4random.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/arc4random.c b/arc4random.c
index b14b723d..c14fc536 100644
--- a/arc4random.c
+++ b/arc4random.c
@@ -50,6 +50,7 @@
#ifndef ARC4RANDOM_NO_INCLUDES
#ifdef WIN32
#include <wincrypt.h>
+#include <process.h>
#else
#include <fcntl.h>
#include <unistd.h>
@@ -216,6 +217,10 @@ arc4_stir(void)
arc4_count = BYTES_BEFORE_RESEED;
}
+#ifdef WIN32
+#define getpid _getpid
+#endif
+
static void
arc4_stir_if_needed(void)
{