2011-10-03 12:38:21 -04:00
|
|
|
$OpenBSD: patch-db_nonce_cpp,v 1.2 2011/10/03 16:38:21 fgsch Exp $
|
|
|
|
--- db/nonce.cpp.orig Sun Sep 11 15:09:34 2011
|
|
|
|
+++ db/nonce.cpp Sun Sep 18 21:35:45 2011
|
|
|
|
@@ -42,7 +42,7 @@ namespace mongo {
|
2011-06-01 20:26:32 -04:00
|
|
|
massert( 10353 , "can't open dev/urandom", _devrandom->is_open() );
|
|
|
|
#elif defined(_WIN32)
|
2011-10-03 12:38:21 -04:00
|
|
|
srand(curTimeMicros()); // perhaps not relevant for rand_s but we might want elsewhere anyway
|
2011-06-01 20:26:32 -04:00
|
|
|
-#else
|
|
|
|
+#elif !defined(__openbsd__)
|
|
|
|
srandomdev();
|
|
|
|
#endif
|
|
|
|
|
2011-10-03 12:38:21 -04:00
|
|
|
@@ -63,6 +63,8 @@ namespace mongo {
|
2011-06-01 20:26:32 -04:00
|
|
|
assert( rand_s(&a) == 0 );
|
|
|
|
assert( rand_s(&b) == 0 );
|
|
|
|
n = (((unsigned long long)a)<<32) | b;
|
|
|
|
+#elif defined(__openbsd__)
|
|
|
|
+ n = arc4random();
|
|
|
|
#else
|
|
|
|
n = (((unsigned long long)random())<<32) | random();
|
|
|
|
#endif
|