From: Alejandro Colomar Date: Fri, 6 Dec 2024 21:03:48 +0000 (+0100) Subject: lib/port.c: Use STRSEP2LS() instead of its pattern X-Git-Tag: 4.18.0-rc1~10 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b8e26eb85180199a2a4a2a7d06d26135ef2d8d20;p=thirdparty%2Fshadow.git lib/port.c: Use STRSEP2LS() instead of its pattern Signed-off-by: Alejandro Colomar --- diff --git a/lib/port.c b/lib/port.c index 7e1a7b70e..26f8c2080 100644 --- a/lib/port.c +++ b/lib/port.c @@ -22,6 +22,7 @@ #include "string/strcmp/streq.h" #include "string/strcmp/strprefix.h" #include "string/strtok/stpsep.h" +#include "string/strtok/strsep2ls.h" static FILE *ports; @@ -160,13 +161,7 @@ next: goto next; port.pt_names = ttys; - for (j = 0; j < PORT_TTY; j++) { - port.pt_names[j] = strsep(&cp, ","); - if (cp == NULL) - break; - } - port.pt_names[j] = NULL; - if (cp != NULL) + if (STRSEP2LS(cp, ",", ttys) == -1) goto next; /* @@ -181,13 +176,7 @@ next: goto next; port.pt_users = users; - for (j = 0; j < PORT_IDS; j++) { - port.pt_users[j] = strsep(&cp, ","); - if (cp == NULL) - break; - } - port.pt_users[j] = NULL; - if (cp != NULL) + if (STRSEP2LS(cp, ",", users) == -1) goto next; /*