diff options
author | Alejandro Colomar <alx@kernel.org> | 2024-01-15 17:18:33 +0100 |
---|---|---|
committer | Serge Hallyn <serge@hallyn.com> | 2024-03-14 17:11:36 -0500 |
commit | ae17e0291d313e08a2a3071083a8e2b5a4a362b2 (patch) | |
tree | 7ad8c491bb6c23374b28befd023c7397e77721b9 | |
parent | 03677d9acfa1246e12dbb18f8c677eacd0da8a38 (diff) |
lib/port.c: getportent(): Call strpbrk(3) instead of open-coding it
Signed-off-by: Alejandro Colomar <alx@kernel.org>
-rw-r--r-- | lib/port.c | 10 |
1 files changed, 3 insertions, 7 deletions
@@ -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; |