summaryrefslogtreecommitdiffstats
path: root/system/ksh-openbsd/patches/linux/var_c.diff
diff options
context:
space:
mode:
Diffstat (limited to 'system/ksh-openbsd/patches/linux/var_c.diff')
-rw-r--r--system/ksh-openbsd/patches/linux/var_c.diff53
1 files changed, 53 insertions, 0 deletions
diff --git a/system/ksh-openbsd/patches/linux/var_c.diff b/system/ksh-openbsd/patches/linux/var_c.diff
new file mode 100644
index 0000000000..9483a3b4ce
--- /dev/null
+++ b/system/ksh-openbsd/patches/linux/var_c.diff
@@ -0,0 +1,53 @@
+--- 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 <sys/stat.h>
+ #include <ctype.h>
++#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: