summaryrefslogtreecommitdiffstats
path: root/lib/libedit
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2000-05-22 05:55:22 +0000
committerimp <imp@FreeBSD.org>2000-05-22 05:55:22 +0000
commitb28a6e4dcf92d7256e29b742368a144d47ee75b6 (patch)
treeb047877ee6cbfa03d1fe596c5c3739465882973f /lib/libedit
parent028d2de70c4e2efc19f3e5b69a633afa73afe17d (diff)
downloadFreeBSD-src-b28a6e4dcf92d7256e29b742368a144d47ee75b6.zip
FreeBSD-src-b28a6e4dcf92d7256e29b742368a144d47ee75b6.tar.gz
Do not read editrc file from '.'. This can be as unsafe as having
. first in root's path. While I'm here: o Add $FreeBSD$ o Get errno from <errno.h>, but extern int errno. Submitted by: Tim Vanderhoek
Diffstat (limited to 'lib/libedit')
-rw-r--r--lib/libedit/editline.32
-rw-r--r--lib/libedit/el.c21
2 files changed, 11 insertions, 12 deletions
diff --git a/lib/libedit/editline.3 b/lib/libedit/editline.3
index 7528f5f..3dda60d 100644
--- a/lib/libedit/editline.3
+++ b/lib/libedit/editline.3
@@ -381,8 +381,6 @@ If
is
.Dv NULL ,
try
-.Pa $PWD/.editrc
-then
.Pa $HOME/.editrc .
Refer to
.Xr editrc 5
diff --git a/lib/libedit/el.c b/lib/libedit/el.c
index 87f6813..3ab5d83 100644
--- a/lib/libedit/el.c
+++ b/lib/libedit/el.c
@@ -34,9 +34,13 @@
* SUCH DAMAGE.
*/
-#if !defined(lint) && !defined(SCCSID)
+#if !defined(lint)
+#if 0
static char sccsid[] = "@(#)el.c 8.2 (Berkeley) 1/3/94";
-#endif /* not lint && not SCCSID */
+#endif
+static const char rcsid[] =
+ "$FreeBSD$"
+#endif /* not lint */
/*
* el.c: EditLine interface functions
@@ -45,6 +49,7 @@ static char sccsid[] = "@(#)el.c 8.2 (Berkeley) 1/3/94";
#include <sys/types.h>
#include <sys/param.h>
+#include <errno.h>
#include <string.h>
#include <stdlib.h>
#if __STDC__
@@ -80,7 +85,6 @@ el_init(prog, fin, fout)
if (issetugid() == 0 && (tty = getenv("DEBUGTTY")) != NULL) {
el->el_errfile = fopen(tty, "w");
if (el->el_errfile == NULL) {
- extern errno;
(void) fprintf(stderr, "Cannot open %s (%s).\n",
tty, strerror(errno));
return NULL;
@@ -290,13 +294,10 @@ el_source(el, fname)
char *ptr, path[MAXPATHLEN];
if (fname == NULL) {
- fname = &elpath[1];
- if ((fp = fopen(fname, "r")) == NULL) {
- if (issetugid() != 0 || (ptr = getenv("HOME")) == NULL)
- return -1;
- (void)snprintf(path, sizeof(path), "%s%s", ptr, elpath);
- fname = path;
- }
+ if (issetugid() != 0 || (ptr = getenv("HOME")) == NULL)
+ return -1;
+ (void) snprintf(path, sizeof(path), "%s%s", ptr, elpath);
+ fname = path;
}
if ((fp = fopen(fname, "r")) == NULL)
OpenPOWER on IntegriCloud