BIND 10 master, updated. c11a19fe6b38b10575aa8e2a9582eb1d7e12281d fillRandom now uses random() instead of rand()

BIND 10 source code commits bind10-changes at lists.isc.org
Thu May 10 15:34:01 UTC 2012


The branch, master has been updated
       via  c11a19fe6b38b10575aa8e2a9582eb1d7e12281d (commit)
      from  c09c891d2c63f34f5d9ede256a956fc99c27c9e3 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit c11a19fe6b38b10575aa8e2a9582eb1d7e12281d
Author: Tomek Mrugalski <tomasz at isc.org>
Date:   Thu May 10 17:33:05 2012 +0200

    fillRandom now uses random() instead of rand()
    
    - a generic improvement that fixes NetBSD test failure.

-----------------------------------------------------------------------

Summary of changes:
 src/bin/dhcp6/dhcp6_srv.cc                     |    3 ++-
 src/lib/util/range_utilities.h                 |    4 ++--
 src/lib/util/tests/range_utilities_unittest.cc |    3 +++
 3 files changed, 7 insertions(+), 3 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/bin/dhcp6/dhcp6_srv.cc b/src/bin/dhcp6/dhcp6_srv.cc
index cc4219e..4497e22 100644
--- a/src/bin/dhcp6/dhcp6_srv.cc
+++ b/src/bin/dhcp6/dhcp6_srv.cc
@@ -12,6 +12,7 @@
 // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 // PERFORMANCE OF THIS SOFTWARE.
 
+#include <stdlib.h>
 #include <time.h>
 #include <dhcp/dhcp6.h>
 #include <dhcp/pkt6.h>
@@ -220,7 +221,7 @@ void Dhcpv6Srv::setServerID() {
 
     // Length of the identifier is company specific. I hereby declare
     // ISC "standard" of 6 bytes long pseudo-random numbers.
-    srand(time(NULL));
+    srandom(time(NULL));
     fillRandom(&srvid[6],&srvid[12]);
 
     serverid_ = OptionPtr(new Option(Option::V6, D6O_SERVERID,
diff --git a/src/lib/util/range_utilities.h b/src/lib/util/range_utilities.h
index 3ba2cb5..3f8b971 100644
--- a/src/lib/util/range_utilities.h
+++ b/src/lib/util/range_utilities.h
@@ -15,7 +15,7 @@
 #ifndef __RANGE_UTIL_H_
 #define __RANGE_UTIL_H_ 1
 
-#include <cstdlib>
+#include <stdlib.h>
 #include <algorithm>
 
 // This header contains useful methods for conduction operations on
@@ -58,7 +58,7 @@ template <typename Iterator>
 void
 fillRandom(Iterator begin, Iterator end) {
     for (Iterator x = begin; x != end; ++x) {
-        *x = std::rand();
+        *x = random();
     }
 }
 
diff --git a/src/lib/util/tests/range_utilities_unittest.cc b/src/lib/util/tests/range_utilities_unittest.cc
index 31f9f21..6fa1c64 100644
--- a/src/lib/util/tests/range_utilities_unittest.cc
+++ b/src/lib/util/tests/range_utilities_unittest.cc
@@ -14,6 +14,7 @@
 
 #include <config.h>
 #include <stdint.h>
+#include <stdlib.h>
 
 #include <gtest/gtest.h>
 #include <vector>
@@ -38,6 +39,8 @@ TEST(RangeUtilitiesTest, isZero) {
 
 TEST(RangeUtilitiesTest, randomFill) {
 
+    srandom(time(NULL));
+
     vector<uint8_t> vec1(16,0);
     vector<uint8_t> vec2(16,0);
 



More information about the bind10-changes mailing list