Work around Travis "virtual memory exhausted" error
[openssl.git] / crypto / rand / rand_egd.c
index f4bfd8696c1543b361e9e51c226203c32466910c..dd58b214981efd3d1d4fbf4e0f537e9da2a69959 100644 (file)
@@ -48,7 +48,7 @@ NON_EMPTY_TRANSLATION_UNIT
  *         the number of bytes requested or smaller, if the EGD pool is
  *         drained and the daemon signals that the pool is empty.
  *
- * RAND_egd(path) will query 255 bytes and use the bytes retreived to seed
+ * RAND_egd(path) will query 255 bytes and use the bytes retrieved to seed
  *   the PRNG.
  *   RAND_egd() is a wrapper for RAND_egd_bytes() with numbytes=255.
  */
@@ -133,6 +133,7 @@ int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes)
                 break;
 #  endif
             default:
+                ret = -1;
                 goto err;       /* failure */
             }
         }
@@ -227,10 +228,10 @@ int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes)
 
 int RAND_egd_bytes(const char *path, int bytes)
 {
-    int num, ret = 0;
+    int num, ret = -1;
 
     num = RAND_query_egd_bytes(path, NULL, bytes);
-    if (num < 1)
+    if (num < 0)
         goto err;
     if (RAND_status() == 1)
         ret = num;