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 16cc27a..dfec2c7 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;
         }