Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 23 Jan 2019 20:02:17 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r343354 - head/usr.bin/write
Message-ID:  <201901232002.x0NK2HXQ082968@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Wed Jan 23 20:02:17 2019
New Revision: 343354
URL: https://svnweb.freebsd.org/changeset/base/343354

Log:
  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

Modified:
  head/usr.bin/write/write.c

Modified: head/usr.bin/write/write.c
==============================================================================
--- head/usr.bin/write/write.c	Wed Jan 23 18:58:15 2019	(r343353)
+++ head/usr.bin/write/write.c	Wed Jan 23 20:02:17 2019	(r343354)
@@ -204,7 +204,6 @@ utmp_chk(char *user, char *tty)
 	struct utmpx lu, *u;
 
 	strncpy(lu.ut_line, tty, sizeof lu.ut_line);
-	setutxent();
 	while ((u = getutxline(&lu)) != NULL)
 		if (u->ut_type == USER_PROCESS &&
 		    strcmp(user, u->ut_user) == 0) {
@@ -237,7 +236,6 @@ search_utmp(int devfd, char *user, char *tty, char *my
 	bestatime = 0;
 	user_is_me = 0;
 
-	setutxent();
 	while ((u = getutxent()) != NULL)
 		if (u->ut_type == USER_PROCESS &&
 		    strcmp(user, u->ut_user) == 0) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201901232002.x0NK2HXQ082968>