random_seed: simplify
authorMåns Rullgård <mans@mansr.com>
Thu, 1 Jul 2010 11:43:30 +0000 (11:43 +0000)
committerMåns Rullgård <mans@mansr.com>
Thu, 1 Jul 2010 11:43:30 +0000 (11:43 +0000)
Originally committed as revision 23932 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavutil/random_seed.c

index 929e8e0..86c60f3 100644 (file)
@@ -40,12 +40,10 @@ static int read_random(uint32_t *dst, const char *file)
 uint32_t av_get_random_seed(void)
 {
     uint32_t seed;
-    int err;
 
-    err = read_random(&seed, "/dev/urandom");
-    if (err != sizeof(seed))
-        err = read_random(&seed, "/dev/random");
-    if (err == sizeof(seed))
+    if (read_random(&seed, "/dev/urandom") == sizeof(seed))
+        return seed;
+    if (read_random(&seed, "/dev/random")  == sizeof(seed))
         return seed;
 
 #ifdef AV_READ_TIME