summaryrefslogtreecommitdiffstats
path: root/lib/libedit/el.c
diff options
context:
space:
mode:
authormsmith <msmith@FreeBSD.org>1997-06-25 08:14:24 +0000
committermsmith <msmith@FreeBSD.org>1997-06-25 08:14:24 +0000
commitf4312c45dc5fb1b4831e63087e8563fa0fa4601f (patch)
treebfe4a6c5e19e7694273d28cb1b36a820a5ebad0d /lib/libedit/el.c
parentd2cf9d630277a4d4f8601691fb1ac28b727e417e (diff)
downloadFreeBSD-src-f4312c45dc5fb1b4831e63087e8563fa0fa4601f.zip
FreeBSD-src-f4312c45dc5fb1b4831e63087e8563fa0fa4601f.tar.gz
Update libedit with changes from NetBSD. Includes history load/save,
some buffer overflow guards and some stylistic cleanups. Also adds manpages. Obtained from: NetBSD
Diffstat (limited to 'lib/libedit/el.c')
-rw-r--r--lib/libedit/el.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/libedit/el.c b/lib/libedit/el.c
index 305a51d..f163ec8 100644
--- a/lib/libedit/el.c
+++ b/lib/libedit/el.c
@@ -301,12 +301,16 @@ el_source(el, fname)
if ((fp = fopen(fname, "r")) == NULL)
return -1;
- while ((ptr = fgetln(fp, &len)) != NULL)
- ptr[len - 1] = '\0';
+ while ((ptr = fgetln(fp, &len)) != NULL) {
+ if (ptr[len - 1] == '\n')
+ --len;
+ ptr[len] = '\0';
+
if (parse_line(el, ptr) == -1) {
(void) fclose(fp);
return -1;
}
+ }
(void) fclose(fp);
return 0;
OpenPOWER on IntegriCloud