]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib/motd.c: motd(): Invert logic to reduce indentation
authorAlejandro Colomar <alx@kernel.org>
Fri, 15 Nov 2024 22:50:57 +0000 (23:50 +0100)
committerSerge Hallyn <serge@hallyn.com>
Sat, 8 Feb 2025 05:22:10 +0000 (23:22 -0600)
Signed-off-by: Alejandro Colomar <alx@kernel.org>
lib/motd.c

index 6394dbd945d647dace4e8026ed0e20a445ee1c1d..bed9efae2b0edc80fa522e8b61dff879be28441c 100644 (file)
@@ -46,15 +46,15 @@ motd(void)
        mb = motdlist;
        while (NULL != (motdfile = strsep(&mb, ":"))) {
                fp = fopen (motdfile, "r");
-               if (NULL != fp) {
-                       while ((c = getc (fp)) != EOF) {
-                               putchar (c);
-                       }
-                       fclose (fp);
+               if (fp == NULL)
+                       continue;
+
+               while ((c = getc(fp)) != EOF) {
+                       putchar(c);
                }
+               fclose(fp);
        }
        fflush (stdout);
 
        free (motdlist);
 }
-