lib/gshadow.c: endsgent(): Invert logic to reduce indentation

Signed-off-by: Alejandro Colomar <alx@kernel.org>
This commit is contained in:
Alejandro Colomar
2024-07-21 18:18:08 +02:00
committed by Serge Hallyn
parent 99a3ca17df
commit 9d8145acfc
+19 -19
View File
@@ -155,29 +155,29 @@ void endsgent (void)
return NULL;
}
if (fgetsx(buf, buflen, fp) == buf) {
while ( (strrchr(buf, '\n') == NULL)
&& (feof (fp) == 0)) {
size_t len;
if (fgetsx(buf, buflen, fp) == NULL)
return NULL;
cp = REALLOC(buf, buflen * 2, char);
if (NULL == cp) {
return NULL;
}
buf = cp;
buflen *= 2;
while ( (strrchr(buf, '\n') == NULL)
&& (feof (fp) == 0)) {
size_t len;
len = strlen (buf);
if (fgetsx (&buf[len],
(int) (buflen - len),
fp) != &buf[len]) {
return NULL;
}
cp = REALLOC(buf, buflen * 2, char);
if (NULL == cp) {
return NULL;
}
buf = cp;
buflen *= 2;
len = strlen (buf);
if (fgetsx (&buf[len],
(int) (buflen - len),
fp) != &buf[len]) {
return NULL;
}
stpsep(buf, "\n");
return (sgetsgent (buf));
}
return NULL;
stpsep(buf, "\n");
return (sgetsgent (buf));
}
/*