From: Alejandro Colomar Date: Mon, 15 Jan 2024 16:18:33 +0000 (+0100) Subject: lib/port.c: getportent(): Call strpbrk(3) instead of open-coding it X-Git-Tag: 4.15.1~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ae17e0291d313e08a2a3071083a8e2b5a4a362b2;p=thirdparty%2Fshadow.git lib/port.c: getportent(): Call strpbrk(3) instead of open-coding it Signed-off-by: Alejandro Colomar --- diff --git a/lib/port.c b/lib/port.c index 8a45b67e4..05b95651d 100644 --- a/lib/port.c +++ b/lib/port.c @@ -127,7 +127,7 @@ static struct port *getportent (void) * - parse off a list of days and times */ - again: +again: /* * Get the next line and remove optional trailing '\n'. @@ -154,13 +154,9 @@ static struct port *getportent (void) port.pt_names = ttys; for (cp = buf, j = 0; j < PORT_TTY; j++) { port.pt_names[j] = cp; - while (('\0' != *cp) && (':' != *cp) && (',' != *cp)) { - cp++; - } - - if ('\0' == *cp) { + cp = strpbrk(cp, ":,"); + if (cp == NULL) goto again; /* line format error */ - } if (':' == *cp) { /* end of tty name list */ break;