Commit af26b4ce authored by mru's avatar mru

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

git-svn-id: file:///var/local/repositories/ffmpeg/trunk@22450 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent f64d4a43
...@@ -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