[FFmpeg-cvslog] r22450 - trunk/libavutil/random_seed.c

mru subversion
Thu Mar 11 03:32:11 CET 2010


Author: mru
Date: Thu Mar 11 03:32:11 2010
New Revision: 22450

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

Modified:
   trunk/libavutil/random_seed.c

Modified: trunk/libavutil/random_seed.c
==============================================================================
--- trunk/libavutil/random_seed.c	Thu Mar 11 03:32:08 2010	(r22449)
+++ trunk/libavutil/random_seed.c	Thu Mar 11 03:32:11 2010	(r22450)
@@ -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



More information about the ffmpeg-cvslog mailing list