Browse code

random_seed: allow to block on /dev/random

If both /dev/random and /dev/urandom failed to return data, an
uninitialised value might be returned. Since most systems have a
non-blocking /dev/urandom or have /dev/random with similar properties,
the chance of blocking is minimal, and the alternative of returning
non-random data is worse.

Originally committed as revision 23930 to svn://svn.ffmpeg.org/ffmpeg/trunk

Måns Rullgård authored on 2010/07/01 20:40:50
Showing 1 changed files
... ...
@@ -31,9 +31,6 @@ static int read_random(uint32_t *dst, const char *file)
31 31
 
32 32
     if (fd == -1)
33 33
         return -1;
34
-#if HAVE_FCNTL && defined(O_NONBLOCK)
35
-    if (fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_NONBLOCK) != -1)
36
-#endif
37 34
         err = read(fd, dst, sizeof(*dst));
38 35
     close(fd);
39 36