]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib/port.c: getportent(): Call strpbrk(3) instead of open-coding it
authorAlejandro Colomar <alx@kernel.org>
Mon, 15 Jan 2024 16:18:33 +0000 (17:18 +0100)
committerSerge Hallyn <serge@hallyn.com>
Thu, 14 Mar 2024 22:11:36 +0000 (17:11 -0500)
Signed-off-by: Alejandro Colomar <alx@kernel.org>
lib/port.c

index 8a45b67e448a9d3cc5dfe52a1474fb3dc8c0cb07..05b95651db0f571c1132ea7f6af104e4f7e2f503 100644 (file)
@@ -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;