Commit 49e92878 authored by Måns Rullgård's avatar Måns Rullgård

random_seed: try other alternatives if reading /dev/random fails

Originally committed as revision 22450 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 32f40ace
...@@ -31,8 +31,9 @@ uint32_t ff_random_get_seed(void) ...@@ -31,8 +31,9 @@ uint32_t ff_random_get_seed(void)
if ((fd = open("/dev/random", O_RDONLY)) == -1) if ((fd = open("/dev/random", O_RDONLY)) == -1)
fd = open("/dev/urandom", O_RDONLY); fd = open("/dev/urandom", O_RDONLY);
if (fd != -1){ if (fd != -1){
read(fd, &seed, 4); int err = read(fd, &seed, 4);
close(fd); close(fd);
if (err == 4)
return seed; return seed;
} }
#ifdef AV_READ_TIME #ifdef AV_READ_TIME
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment