--- ksh-openbsd_cvs/var.c 2010-02-23 12:49:23.000000000 +0100 +++ ksh-openbsd_cvs.new/var.c 2010-04-01 21:01:24.145380963 +0200 @@ -5,6 +5,7 @@ #include "ksh_limval.h" #include #include +#include "strlcpy.h" /* * Variables @@ -865,12 +866,6 @@ makenv(void) } /* - * Someone has set the srand() value, therefore from now on - * we return values from rand() instead of arc4random() - */ -int use_rand = 0; - -/* * Called after a fork in parent to bump the random number generator. * Done to ensure children will not get the same random number sequence * if the parent doesn't use $RANDOM. @@ -878,8 +873,7 @@ int use_rand = 0; void change_random(void) { - if (use_rand) - rand(); + rand(); } /* @@ -926,10 +920,7 @@ getspec(struct tbl *vp) break; case V_RANDOM: vp->flag &= ~SPECIAL; - if (use_rand) - setint(vp, (long) (rand() & 0x7fff)); - else - setint(vp, (long) (arc4random() & 0x7fff)); + setint(vp, (long) (rand() & 0x7fff)); vp->flag |= SPECIAL; break; #ifdef HISTORY @@ -1030,7 +1021,6 @@ setspec(struct tbl *vp) case V_RANDOM: vp->flag &= ~SPECIAL; srand((unsigned int)intval(vp)); - use_rand = 1; vp->flag |= SPECIAL; break; case V_SECONDS: