aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil
diff options
context:
space:
mode:
authorMåns Rullgård <mans@mansr.com>2010-03-11 02:32:11 +0000
committerMåns Rullgård <mans@mansr.com>2010-03-11 02:32:11 +0000
commit49e92878788e39fff7d103940f512f38b4225068 (patch)
tree4d4531bbdb28299b353be25074332dfb0dfffeed /libavutil
parent32f40ace25699ae28b711d6967934a9ff4ccb2f3 (diff)
downloadffmpeg-49e92878788e39fff7d103940f512f38b4225068.tar.gz
random_seed: try other alternatives if reading /dev/random fails
Originally committed as revision 22450 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavutil')
-rw-r--r--libavutil/random_seed.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavutil/random_seed.c b/libavutil/random_seed.c
index 2b2985d446..d3975653a1 100644
--- a/libavutil/random_seed.c
+++ b/libavutil/random_seed.c
@@ -31,8 +31,9 @@ uint32_t ff_random_get_seed(void)
if ((fd = open("/dev/random", O_RDONLY)) == -1)
fd = open("/dev/urandom", O_RDONLY);
if (fd != -1){
- read(fd, &seed, 4);
+ int err = read(fd, &seed, 4);
close(fd);
+ if (err == 4)
return seed;
}
#ifdef AV_READ_TIME