commit: 507638d422b5537e7652f70592c24c51cbdfc056
parent: a2c12c5e4fa6424bd0f76ed8a79de393bae727a2
author: Brian Callahan <dodonpachi-github@mailinator.com>
date: Tue, 7 Apr 2015 17:41:15 -0400
Update oksh to latest OpenBSD code.
5 files changed, 22 insertions(+), 16 deletions(-)
diff --git a/edit.c b/edit.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: edit.c,v 1.39 2013/12/17 16:37:05 deraadt Exp $ */
+/* $OpenBSD: edit.c,v 1.40 2015/03/12 10:20:30 sthen Exp $ */
/*
* Command line editing - common code
@@ -805,7 +805,7 @@ x_escape(const char *s, size_t len, int (*putbuf_func) (const char *, size_t))
int rval = 0;
for (add = 0, wlen = len; wlen - add > 0; add++) {
- if (strchr("\"#$&'()*:;<=>?[\\]`{|}", s[add]) ||
+ if (strchr("!\"#$&'()*:;<=>?[\\]`{|}", s[add]) ||
strchr(ifs, s[add])) {
if (putbuf_func(s, add) != 0) {
rval = -1;
diff --git a/emacs.c b/emacs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: emacs.c,v 1.48 2013/12/17 16:37:05 deraadt Exp $ */
+/* $OpenBSD: emacs.c,v 1.50 2015/03/25 12:10:52 jca Exp $ */
/*
* Emacs-like command line editing and history
@@ -331,7 +331,7 @@ x_emacs(char *buf, size_t len)
if (at > k->len)
continue;
- if (!bcmp(k->seq, line, at)) {
+ if (memcmp(k->seq, line, at) == 0) {
/* sub match */
submatch++;
if (k->len == at)
@@ -1296,7 +1296,7 @@ kb_match(char *s)
if (len > k->len)
continue;
- if (!bcmp(k->seq, s, len))
+ if (memcmp(k->seq, s, len) == 0)
return (1);
}
@@ -1503,7 +1503,7 @@ x_init_emacs(void)
kb_add(x_comp_list, NULL, CTRL('['), '=', 0);
kb_add(x_del_back, NULL, CTRL('?'), 0);
kb_add(x_del_back, NULL, CTRL('H'), 0);
- /* x_del_char not assigned by default */
+ kb_add(x_del_char, NULL, CTRL('['), '[', '3', '~', 0); /* delete */
kb_add(x_del_bword, NULL, CTRL('['), CTRL('?'), 0);
kb_add(x_del_bword, NULL, CTRL('['), CTRL('H'), 0);
kb_add(x_del_bword, NULL, CTRL('['), 'h', 0);
diff --git a/main.c b/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.54 2013/11/28 10:33:37 sobrado Exp $ */
+/* $OpenBSD: main.c,v 1.55 2015/02/09 09:09:30 jsg Exp $ */
/*
* startup, main loop, environments and error handling
@@ -639,6 +639,13 @@ unwind(int i)
default:
quitenv(NULL);
+ /*
+ * quitenv() may have reclaimed the memory
+ * used by source which will end badly when
+ * we jump to a function that expects it to
+ * be valid
+ */
+ source = NULL;
}
}
}
diff --git a/misc.c b/misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: misc.c,v 1.38 2013/11/28 10:33:37 sobrado Exp $ */
+/* $OpenBSD: misc.c,v 1.40 2015/03/18 15:12:36 tedu Exp $ */
/*
* Miscellaneous functions
@@ -6,7 +6,6 @@
#include "sh.h"
#include <ctype.h>
-#include <sys/param.h> /* for MAXPATHLEN */
#include "charclass.h"
short ctypes [UCHAR_MAX+1]; /* type bits for unsigned char */
@@ -1054,10 +1053,7 @@ strip_nuls(char *buf, int nbytes)
{
char *dst;
- /* nbytes check because some systems (older freebsd's) have a buggy
- * memchr()
- */
- if (nbytes && (dst = memchr(buf, '\0', nbytes))) {
+ if ((dst = memchr(buf, '\0', nbytes))) {
char *end = buf + nbytes;
char *p, *q;
@@ -1120,7 +1116,7 @@ reset_nonblock(int fd)
}
-/* Like getcwd(), except bsize is ignored if buf is 0 (MAXPATHLEN is used) */
+/* Like getcwd(), except bsize is ignored if buf is 0 (PATH_MAX is used) */
char *
ksh_get_wd(char *buf, int bsize)
{
@@ -1131,8 +1127,8 @@ ksh_get_wd(char *buf, int bsize)
* inject possibly allocated space into the ATEMP area. */
/* Assume getcwd() available */
if (!buf) {
- bsize = MAXPATHLEN;
- b = alloc(MAXPATHLEN + 1, ATEMP);
+ bsize = PATH_MAX;
+ b = alloc(PATH_MAX + 1, ATEMP);
} else
b = buf;
diff --git a/var.c b/var.c
@@ -8,6 +8,9 @@
#include <limits.h>
#include <stdlib.h>
+/*
+ * Since no one else has this...
+ */
#ifndef __OpenBSD__
#define srand_deterministic(x) srand(x)
#endif