summaryrefslogtreecommitdiffstats
path: root/system/pdksh/patches/116_OpenBSD-history.patch
diff options
context:
space:
mode:
Diffstat (limited to 'system/pdksh/patches/116_OpenBSD-history.patch')
-rw-r--r--system/pdksh/patches/116_OpenBSD-history.patch47
1 files changed, 47 insertions, 0 deletions
diff --git a/system/pdksh/patches/116_OpenBSD-history.patch b/system/pdksh/patches/116_OpenBSD-history.patch
new file mode 100644
index 0000000000..9be184b298
--- /dev/null
+++ b/system/pdksh/patches/116_OpenBSD-history.patch
@@ -0,0 +1,47 @@
+From OpenBSD:
+
+2008-07-03 19:52 otto
+
+ * lex.c (1.44): fix inifinite loop with set -o csh-history and
+ !<space> as input. report and testing by david@; ok millert@
+ jaredy@
+
+2008-05-20 02:30 fgsch
+
+ * history.c (1.36): cast pointer arithmetic to unsigned so we can
+ behave correctly on underflows. fixes fc -l 1 in my box where
+ line is 1667511151. krw@ ok.
+
+Index: pdksh-5.2.14/history.c
+===================================================================
+--- pdksh-5.2.14.orig/history.c 2009-09-17 22:18:37.000000000 +0200
++++ pdksh-5.2.14/history.c 2009-09-17 23:46:06.000000000 +0200
+@@ -385,7 +385,7 @@
+
+ if (getn(str, &n)) {
+ hp = histptr + (n < 0 ? n : (n - hist_source->line));
+- if (hp < history) {
++ if ((long)hp < (long)history) {
+ if (approx)
+ hp = hist_get_oldest();
+ else {
+@@ -862,7 +862,8 @@
+ if (base != MAP_FAILED)
+ munmap((caddr_t)base, hsize);
+ hist_finish();
+- unlink(hname);
++ if (unlink(hname) != 0)
++ return;
+ goto retry;
+ }
+ if (hsize > 2) {
+@@ -870,7 +871,8 @@
+ if (lines > histsize) {
+ /* we need to make the file smaller */
+ if (hist_shrink(base, hsize))
+- unlink(hname);
++ if (unlink(hname) != 0)
++ return;
+ munmap((caddr_t)base, hsize);
+ hist_finish();
+ goto retry;