src/login_nopam.c: login_access(): Use stpsep() to simplify

Signed-off-by: Alejandro Colomar <alx@kernel.org>
This commit is contained in:
Alejandro Colomar
2024-07-04 14:35:24 +02:00
committed by Serge Hallyn
parent a7b169be18
commit 568d26d7ed
+2 -2
View File
@@ -104,7 +104,7 @@ int login_access (const char *user, const char *from)
while ( !match
&& (fgets (line, sizeof (line), fp) == line)) {
lineno++;
if (line[0] == '\0' || strchr(line, '\n') == NULL) {
if (stpsep(line, "\n") == NULL) {
SYSLOG ((LOG_ERR,
"%s: line %d: missing newline or line too long",
TABLE, lineno));
@@ -113,7 +113,7 @@ int login_access (const char *user, const char *from)
if (line[0] == '#') {
continue; /* comment line */
}
stpcpy(strrspn(line, " \t\n"), "");
stpcpy(strrspn(line, " \t"), "");
if (line[0] == '\0') { /* skip blank lines */
continue;
}