Deleted Added
full compact
random.c (241031) random.c (241046)
1/*
2 * Copyright (c) 1983, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 17 unchanged lines hidden (view full) ---

26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
30#if defined(LIBC_SCCS) && !defined(lint)
31static char sccsid[] = "@(#)random.c 8.2 (Berkeley) 5/19/95";
32#endif /* LIBC_SCCS and not lint */
33#include <sys/cdefs.h>
1/*
2 * Copyright (c) 1983, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 17 unchanged lines hidden (view full) ---

26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
30#if defined(LIBC_SCCS) && !defined(lint)
31static char sccsid[] = "@(#)random.c 8.2 (Berkeley) 5/19/95";
32#endif /* LIBC_SCCS and not lint */
33#include <sys/cdefs.h>
34__FBSDID("$FreeBSD: head/lib/libc/stdlib/random.c 241031 2012-09-28 13:50:37Z des $");
34__FBSDID("$FreeBSD: head/lib/libc/stdlib/random.c 241046 2012-09-29 11:54:34Z jilles $");
35
36#include "namespace.h"
37#include <sys/time.h> /* for srandomdev() */
38#include <fcntl.h> /* for srandomdev() */
39#include <stdint.h>
40#include <stdio.h>
41#include <stdlib.h>
42#include <unistd.h> /* for srandomdev() */

--- 255 unchanged lines hidden (view full) ---

298 size_t len;
299
300 if (rand_type == TYPE_0)
301 len = sizeof state[0];
302 else
303 len = rand_deg * sizeof state[0];
304
305 done = 0;
35
36#include "namespace.h"
37#include <sys/time.h> /* for srandomdev() */
38#include <fcntl.h> /* for srandomdev() */
39#include <stdint.h>
40#include <stdio.h>
41#include <stdlib.h>
42#include <unistd.h> /* for srandomdev() */

--- 255 unchanged lines hidden (view full) ---

298 size_t len;
299
300 if (rand_type == TYPE_0)
301 len = sizeof state[0];
302 else
303 len = rand_deg * sizeof state[0];
304
305 done = 0;
306 fd = _open("/dev/random", O_RDONLY, 0);
306 fd = _open("/dev/random", O_RDONLY | O_CLOEXEC, 0);
307 if (fd >= 0) {
308 if (_read(fd, (void *) state, len) == (ssize_t) len)
309 done = 1;
310 _close(fd);
311 }
312
313 if (!done) {
314 struct timeval tv;

--- 181 unchanged lines hidden ---
307 if (fd >= 0) {
308 if (_read(fd, (void *) state, len) == (ssize_t) len)
309 done = 1;
310 _close(fd);
311 }
312
313 if (!done) {
314 struct timeval tv;

--- 181 unchanged lines hidden ---