From: Alejandro Colomar Date: Tue, 2 Jul 2024 12:03:27 +0000 (+0200) Subject: lib/port.c: getttyuser(): Remove dead code X-Git-Tag: 4.17.0-rc1~142 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a4b91048e9b5fde02722d68c285f8545a0f75fc6;p=thirdparty%2Fshadow.git lib/port.c: getttyuser(): Remove dead code port.pt_names cannot be NULL; it always points to the static array ttys. $ grep -rn pt_names lib/port.c:157: port.pt_names = ttys; lib/port.c:159: port.pt_names[j] = cp; lib/port.c:172: port.pt_names[j] = NULL; lib/port.c:344: for (i = 0; NULL != port->pt_names[i]; i++) { lib/port.c:345: if (portcmp (port->pt_names[i], tty) == 0) { lib/port.c:350: if (port->pt_names[i] == 0) { lib/port.h:39: * pt_names - pointer to array of device names in /dev/ lib/port.h:45: char **pt_names; Signed-off-by: Alejandro Colomar --- diff --git a/lib/port.c b/lib/port.c index 03543d5d6..14ab06c96 100644 --- a/lib/port.c +++ b/lib/port.c @@ -338,10 +338,8 @@ static struct port *getttyuser (const char *tty, const char *user) setportent (); while ((port = getportent ()) != NULL) { - if ( (0 == port->pt_names) - || (0 == port->pt_users)) { + if (NULL == port->pt_users) continue; - } for (i = 0; NULL != port->pt_names[i]; i++) { if (portcmp (port->pt_names[i], tty) == 0) {