diff options
Diffstat (limited to 'lib/libcurses')
-rw-r--r-- | lib/libcurses/tinfo/read_termcap.c | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/lib/libcurses/tinfo/read_termcap.c b/lib/libcurses/tinfo/read_termcap.c index 42f3d641a27..be34f0defd5 100644 --- a/lib/libcurses/tinfo/read_termcap.c +++ b/lib/libcurses/tinfo/read_termcap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: read_termcap.c,v 1.10 2000/08/02 04:10:47 millert Exp $ */ +/* $OpenBSD: read_termcap.c,v 1.11 2000/10/02 22:31:10 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -784,7 +784,7 @@ _nc_tgetent(char *bp, char **sourcename, int *lineno, const char *name) pvec = pathvec; tbuf = bp; p = pathbuf; - cp = getenv("TERMCAP"); + cp = issetugid() ? NULL : getenv("TERMCAP"); /* * TERMCAP can have one of two things in it. It can be the name of a file @@ -798,21 +798,23 @@ _nc_tgetent(char *bp, char **sourcename, int *lineno, const char *name) #define MY_PATH_DEF "/etc/termcap /usr/share/misc/termcap" if (issetugid()) strlcpy(pathbuf, MY_PATH_DEF, PBUFSIZ); - else if (!is_pathname(cp)) { /* no TERMCAP or it holds an entry */ - if ((termpath = getenv("TERMPATH")) != 0) { - strlcpy(pathbuf, termpath, PBUFSIZ); - } else { - if ((home = getenv("HOME")) != 0 && *home != '\0' && - strlen(home) < PBUFSIZ) { /* setup path */ - p += strlen(home); /* path, looking in */ - strcpy(pathbuf, home); /* $HOME first */ - *p++ = '/'; - } /* if no $HOME look in current directory */ - strlcpy(p, ".termcap " MY_PATH_DEF, - (size_t) (PBUFSIZ - (p - pathbuf))); - } - } else /* user-defined name in TERMCAP */ - strlcpy(pathbuf, cp, PBUFSIZ); /* still can be tokenized */ + else { + if (!is_pathname(cp)) { /* no TERMCAP or it holds an entry */ + if ((termpath = getenv("TERMPATH")) != 0) { + strlcpy(pathbuf, termpath, PBUFSIZ); + } else { + if ((home = getenv("HOME")) != 0 && *home != '\0' && + strlen(home) < PBUFSIZ) { /* setup path */ + p += strlen(home); /* path, looking in */ + strcpy(pathbuf, home); /* $HOME first */ + *p++ = '/'; + } /* if no $HOME look in cwd */ + strlcpy(p, ".termcap " MY_PATH_DEF, + (size_t) (PBUFSIZ - (p - pathbuf))); + } + } else /* user-defined name in TERMCAP */ + strlcpy(pathbuf, cp, PBUFSIZ); /* still can be tokenized */ + } *fname++ = pathbuf; /* tokenize path into vector of names */ while (*++p) { @@ -974,7 +976,7 @@ _nc_read_termcap_entry(const char *const tn, TERMTYPE * const tp) char pathbuf[PATH_MAX]; termpaths[filecount] = 0; - if ((tc = getenv("TERMCAP")) != 0 && (!issetugid() || !is_pathname(tc))) { + if (!issetugid() && (tc = getenv("TERMCAP"))) { if (is_pathname(tc)) { /* interpret as a filename */ ADD_TC(tc, 0); } else if (_nc_name_match(tc, tn, "|:")) { /* treat as a capability file */ |