src/login_nopam.c: login_access(): Simplify, calling strchr(3)

Signed-off-by: Alejandro Colomar <alx@kernel.org>
This commit is contained in:
Alejandro Colomar
2024-05-18 22:03:08 +02:00
committed by Serge Hallyn
parent 9174697469
commit 813c3ec6c5
+1 -3
View File
@@ -100,10 +100,8 @@ int login_access (const char *user, const char *from)
int lineno = 0; /* for diagnostics */
while ( !match
&& (fgets (line, sizeof (line), fp) == line)) {
ptrdiff_t end;
lineno++;
end = strlen (line) - 1;
if (line[0] == '\0' || line[end] != '\n') {
if (line[0] == '\0' || strchr(line, '\n') == NULL) {
SYSLOG ((LOG_ERR,
"%s: line %d: missing newline or line too long",
TABLE, lineno));