Remove extraneous setutxent() calls in write(1).

We already call setutxent() once during initialization.  Furthermore,
the subsequent calls occur after the process has entered capability
mode, so they fail, and attempts to fetch database entries fail as
a result.

PR:		235096
Submitted by:	fullermd@over-yonder.net
MFC after:	3 days
This commit is contained in:
Mark Johnston 2019-01-23 20:02:17 +00:00
parent 862203935e
commit 27ed53c311

View File

@ -204,7 +204,6 @@ utmp_chk(char *user, char *tty)
struct utmpx lu, *u; struct utmpx lu, *u;
strncpy(lu.ut_line, tty, sizeof lu.ut_line); strncpy(lu.ut_line, tty, sizeof lu.ut_line);
setutxent();
while ((u = getutxline(&lu)) != NULL) while ((u = getutxline(&lu)) != NULL)
if (u->ut_type == USER_PROCESS && if (u->ut_type == USER_PROCESS &&
strcmp(user, u->ut_user) == 0) { strcmp(user, u->ut_user) == 0) {
@ -237,7 +236,6 @@ search_utmp(int devfd, char *user, char *tty, char *mytty, uid_t myuid)
bestatime = 0; bestatime = 0;
user_is_me = 0; user_is_me = 0;
setutxent();
while ((u = getutxent()) != NULL) while ((u = getutxent()) != NULL)
if (u->ut_type == USER_PROCESS && if (u->ut_type == USER_PROCESS &&
strcmp(user, u->ut_user) == 0) { strcmp(user, u->ut_user) == 0) {