]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib/gshadow.c: endsgent(): Invert logic to reduce indentation
authorAlejandro Colomar <alx@kernel.org>
Sun, 21 Jul 2024 16:18:08 +0000 (18:18 +0200)
committerSerge Hallyn <serge@hallyn.com>
Mon, 11 Nov 2024 05:11:43 +0000 (23:11 -0600)
Signed-off-by: Alejandro Colomar <alx@kernel.org>
lib/gshadow.c

index 6a5cd67b1885b1b69912f2f6eb0bc5a17e3be640..8e9d6c8274ab7885e2e005a8e0bbf0be05b869d3 100644 (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;
-
-                       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));
 }
 
 /*