]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib/gshadow.c: sgetsgent(): Be consistent using NULL
authorAlejandro Colomar <alx@kernel.org>
Tue, 5 Nov 2024 13:10:23 +0000 (14:10 +0100)
committerSerge Hallyn <serge@hallyn.com>
Fri, 6 Dec 2024 03:20:59 +0000 (21:20 -0600)
0 is a horrible null-pointer constant.  Don't use it.
Especially, when just a few lines above, in the same function,
we've used NULL for the same thing.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
lib/gshadow.c

index 5cdc3abe52f81e3ce82d0b79582523eada2da1c6..bd938899514a017b7d5c2c2cc3b9588619f2831b 100644 (file)
@@ -14,6 +14,7 @@
 
 #ident "$Id$"
 
+#include <stddef.h>
 #include <stdio.h>
 #include <string.h>
 
@@ -87,9 +88,9 @@ sgetsgent(const char *string)
 
        if (len > sgrbuflen) {
                char *buf = REALLOC(sgrbuf, len, char);
-               if (NULL == buf) {
+               if (NULL == buf)
                        return NULL;
-               }
+
                sgrbuf = buf;
                sgrbuflen = len;
        }
@@ -111,7 +112,7 @@ sgetsgent(const char *string)
         */
 
        if (NULL != cp || i != FIELDS)
-               return 0;
+               return NULL;
 
        sgroup.sg_name = fields[0];
        sgroup.sg_passwd = fields[1];