From: Alejandro Colomar Date: Sun, 21 Jul 2024 16:18:08 +0000 (+0200) Subject: lib/gshadow.c: endsgent(): Invert logic to reduce indentation X-Git-Tag: 4.17.0-rc1~31 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=9d8145acfc7eba688387c7d3ac4494d39056b30b;p=thirdparty%2Fshadow.git lib/gshadow.c: endsgent(): Invert logic to reduce indentation Signed-off-by: Alejandro Colomar --- diff --git a/lib/gshadow.c b/lib/gshadow.c index 6a5cd67b1..8e9d6c827 100644 --- a/lib/gshadow.c +++ b/lib/gshadow.c @@ -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; - - 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; - } + if (fgetsx(buf, buflen, fp) == NULL) + return NULL; + + while ( (strrchr(buf, '\n') == NULL) + && (feof (fp) == 0)) { + size_t len; + + 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)); } /*