Register missing dependencies for fuzz.c and client-tags.c
[privoxy.git] / miscutil.c
index f5e647c..4a9b88f 100644 (file)
@@ -1,4 +1,4 @@
-const char miscutil_rcs[] = "$Id: miscutil.c,v 1.80 2016/01/16 12:33:36 fabiankeil Exp $";
+const char miscutil_rcs[] = "$Id: miscutil.c,v 1.82 2016/07/23 23:05:15 ler762 Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/miscutil.c,v $
@@ -765,7 +765,9 @@ long int pick_from_range(long int range)
 
    if (range <= 0) return 0;
 
-#ifdef HAVE_RANDOM
+#ifdef HAVE_ARC4RANDOM
+   number = arc4random() % range + 1;
+#elif defined(HAVE_RANDOM)
    number = random() % range + 1;
 #elif defined(MUTEX_LOCKS_AVAILABLE)
    privoxy_mutex_lock(&rand_mutex);
@@ -789,7 +791,7 @@ long int pick_from_range(long int range)
       "might cause crashes, predictable results or even combine these fine options.");
    number = rand() % (long int)(range + 1);
 
-#endif /* (def HAVE_RANDOM) */
+#endif /* (def HAVE_ARC4RANDOM) */
 
    return number;
 }
@@ -893,6 +895,16 @@ time_t timegm(struct tm *tm)
          strcat(old_zone, zone);
          putenv(old_zone);
 #ifdef _WIN32
+         /* http://man7.org/linux/man-pages/man3/putenv.3.html
+          *   int putenv(char *string);
+          *     The string pointed to by string becomes part of the environment, so altering the
+          *     string changes the environment.
+          * In other words, the memory pointed to by *string is used until
+          *   a) another call to putenv() with the same e-var name
+          *   b) the program exits
+          *
+          * Windows e-vars don't work that way, so let's not leak memory.
+          */
          free(old_zone);
 #endif /* def _WIN32 */
       }