]> granicus.if.org Git - apache/commitdiff
move srand() call from ssl_rand_choosenum() to ssl_init_Child()
authorDoug MacEachern <dougm@apache.org>
Thu, 29 Nov 2001 05:08:47 +0000 (05:08 +0000)
committerDoug MacEachern <dougm@apache.org>
Thu, 29 Nov 2001 05:08:47 +0000 (05:08 +0000)
this was being called twice per-connection with 'SSLRandom connect builtin'
configured (which is in the default config)

this also gets rid of two time() syscalls per-connection

PR:
Obtained from:
Submitted by:
Reviewed by:

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@92232 13f79535-47bb-0310-9956-ffa450edef68

modules/ssl/ssl_engine_init.c
modules/ssl/ssl_engine_rand.c

index b3008f3d9e1414deb3b64ea3bc9e3216d5896e3f..69b2eb998846ba30f5ffb315ae470f45a8fa0f7d 100644 (file)
@@ -967,6 +967,9 @@ void ssl_init_Child(apr_pool_t *p, server_rec *s)
     SSLModConfigRec *mc = myModConfig(s);
     mc->pid = getpid(); /* only call getpid() once per-process */
 
+    /* XXX: there should be an ap_srand() function */
+    srand((unsigned int)time(NULL));
+
      /* open the mutex lockfile */
      ssl_mutex_reinit(s, p);
      return;
index 79a5a5171a672e6abf00eb5eff1342cd9f0204e0..36a57bce05b140e1258a5560822c876fbcffefc4 100644 (file)
@@ -203,7 +203,6 @@ static int ssl_rand_choosenum(int l, int h)
     int i;
     char buf[50];
 
-    srand((unsigned int)time(NULL));
     apr_snprintf(buf, sizeof(buf), "%.0f",
                  (((double)(rand()%RAND_MAX)/RAND_MAX)*(h-l)));
     i = atoi(buf)+1;