]> git.sesse.net Git - vlc/commitdiff
rand: Also use /dev/urandom on OpenBSD as well
authorBrad Smith <brad@comstyle.com>
Sun, 29 Jan 2012 01:54:14 +0000 (20:54 -0500)
committerRémi Denis-Courmont <remi@remlab.net>
Sun, 29 Jan 2012 08:22:40 +0000 (10:22 +0200)
On older OpenBSD releases you especially should not have been
using /dev/random, nowdays due to changes all the device nodes
are actually all the same so either way this code can be simplified
to not special case OpenBSD in vlc_rand_init().

Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
src/posix/rand.c

index fbf020f9c9c2875fc7b360ff5154d6d66da67c76..af448fb82d67dbe21ad2406d410e9c5296bd16f3 100644 (file)
@@ -49,15 +49,10 @@ static uint8_t okey[BLOCK_SIZE], ikey[BLOCK_SIZE];
 
 static void vlc_rand_init (void)
 {
-#if defined (__OpenBSD__) || defined (__OpenBSD_kernel__)
-    static const char randfile[] = "/dev/random";
-#else
-    static const char randfile[] = "/dev/urandom";
-#endif
     uint8_t key[BLOCK_SIZE];
 
     /* Get non-predictible value as key for HMAC */
-    int fd = vlc_open (randfile, O_RDONLY);
+    int fd = vlc_open ("/dev/urandom", O_RDONLY);
     if (fd == -1)
         return; /* Uho! */