rand/randfile.c: rationalize __OpenBSD__ code path.
authorAndy Polyakov <appro@openssl.org>
Tue, 20 Sep 2016 15:06:58 +0000 (17:06 +0200)
committerAndy Polyakov <appro@openssl.org>
Wed, 21 Sep 2016 19:09:07 +0000 (21:09 +0200)
Reviewed-by: Rich Salz <rsalz@openssl.org>
crypto/rand/randfile.c

index 16cc27aa9b08f88dc90cac5334d02db8942278cc..dfec2c7d6b128cd9eddf555c0ffef4cd72870cf7 100644 (file)
@@ -357,11 +357,7 @@ const char *RAND_file_name(char *buf, size_t size)
      * available.
      */
 
-    if (!buf[0])
-        if (OPENSSL_strlcpy(buf, "/dev/arandom", size) >= size) {
-            return NULL;
-        }
-    if (stat(buf, &sb) == -1)
+    if (!buf[0] || stat(buf, &sb) == -1)
         if (OPENSSL_strlcpy(buf, "/dev/arandom", size) >= size) {
             return NULL;
         }