Use arc4random instead of random in the flock regress tests.
authorjsing <jsing@openbsd.org>
Fri, 10 Jan 2014 16:34:25 +0000 (16:34 +0000)
committerjsing <jsing@openbsd.org>
Fri, 10 Jan 2014 16:34:25 +0000 (16:34 +0000)
ok deraadt@

regress/sys/kern/flock/flock.c

index e5e0bac..b660674 100644 (file)
@@ -1174,19 +1174,17 @@ test14(int fd, int argc, const char **argv)
                 * Child - do some work and exit.
                 */
                id = id_base + i;
-               srandom(getpid());
-
                for (j = 0; j < 50; j++) {
                        int start, end, len;
                        int set, wrlock;
 
                        do {
-                               start = random() & 127;
-                               end = random() & 127;
+                               start = arc4random_uniform(128);
+                               end = arc4random_uniform(128);
                        } while (end <= start);
 
-                       set = random() & 1;
-                       wrlock = random() & 1;
+                       set = arc4random_uniform(2);
+                       wrlock = arc4random_uniform(2);
 
                        len = end - start;
                        fl.l_start = start;