ossp-pkg/uuid/uuid_prng.c 1.16 -> 1.17
--- uuid_prng.c 2008/01/10 14:18:47 1.16
+++ uuid_prng.c 2008/02/21 08:58:45 1.17
@@ -50,7 +50,9 @@
prng_rc_t prng_create(prng_t **prng)
{
+#if !defined(WIN32)
int fd = -1;
+#endif
struct timeval tv;
pid_t pid;
unsigned int i;
@@ -65,12 +67,14 @@
/* try to open the system PRNG device */
(*prng)->dev = -1;
+#if !defined(WIN32)
if ((fd = open("/dev/urandom", O_RDONLY)) == -1)
fd = open("/dev/random", O_RDONLY|O_NONBLOCK);
if (fd != -1) {
(void)fcntl(fd, F_SETFD, FD_CLOEXEC);
(*prng)->dev = fd;
}
+#endif
/* initialize MD5 engine */
if (md5_create(&((*prng)->md5)) != MD5_RC_OK) {
|
|