summaryrefslogtreecommitdiffstats
path: root/bin/sh/input.c
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2012-01-14 22:46:18 +0000
committerjilles <jilles@FreeBSD.org>2012-01-14 22:46:18 +0000
commitb166a3a40945da4deadb3a68f1dce05af6a574b8 (patch)
tree1b810e1af42eb730dfef629dd31c20a41e9df16e /bin/sh/input.c
parent51c9a6e5fa70888f2cc5432a3b02f9fbfabf1655 (diff)
downloadFreeBSD-src-b166a3a40945da4deadb3a68f1dce05af6a574b8.zip
FreeBSD-src-b166a3a40945da4deadb3a68f1dce05af6a574b8.tar.gz
sh: Change input buffer size from 1023 to 1024.
PR: bin/161756
Diffstat (limited to 'bin/sh/input.c')
-rw-r--r--bin/sh/input.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/bin/sh/input.c b/bin/sh/input.c
index 671bbdf..3ceaea4 100644
--- a/bin/sh/input.c
+++ b/bin/sh/input.c
@@ -97,7 +97,7 @@ int parsenleft; /* copy of parsefile->nleft */
MKINIT int parselleft; /* copy of parsefile->lleft */
char *parsenextc; /* copy of parsefile->nextc */
MKINIT struct parsefile basepf; /* top level input file */
-char basebuf[BUFSIZ]; /* buffer for top level input file */
+char basebuf[BUFSIZ + 1]; /* buffer for top level input file */
static struct parsefile *parsefile = &basepf; /* current input file */
int init_editline = 0; /* editline library initialized? */
int whichprompt; /* 1 == PS1, 2 == PS2 */
@@ -189,8 +189,8 @@ retry:
nr = 0;
else {
nr = el_len;
- if (nr > BUFSIZ - 1)
- nr = BUFSIZ - 1;
+ if (nr > BUFSIZ)
+ nr = BUFSIZ;
memcpy(parsenextc, rl_cp, nr);
if (nr != el_len) {
el_len -= nr;
@@ -200,7 +200,7 @@ retry:
}
} else
#endif
- nr = read(parsefile->fd, parsenextc, BUFSIZ - 1);
+ nr = read(parsefile->fd, parsenextc, BUFSIZ);
if (nr <= 0) {
if (nr < 0) {
@@ -428,13 +428,13 @@ setinputfd(int fd, int push)
(void)fcntl(fd, F_SETFD, FD_CLOEXEC);
if (push) {
pushfile();
- parsefile->buf = ckmalloc(BUFSIZ);
+ parsefile->buf = ckmalloc(BUFSIZ + 1);
}
if (parsefile->fd > 0)
close(parsefile->fd);
parsefile->fd = fd;
if (parsefile->buf == NULL)
- parsefile->buf = ckmalloc(BUFSIZ);
+ parsefile->buf = ckmalloc(BUFSIZ + 1);
parselleft = parsenleft = 0;
plinno = 1;
}
OpenPOWER on IntegriCloud