Skip to content

Commit

Permalink
lib/gshadow.c: sgetsgent(): Be consistent using NULL
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
alejandro-colomar committed Nov 5, 2024
1 parent 554e5fe commit ac58bc2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/gshadow.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#ident "$Id$"

#include <stddef.h>
#include <stdio.h>
#include <string.h>

Expand Down Expand Up @@ -88,9 +89,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;
}
Expand All @@ -112,7 +113,7 @@ sgetsgent(const char *string)
*/

if (NULL != cp || i != FIELDS)
return 0;
return NULL;

sgroup.sg_name = fields[0];
sgroup.sg_passwd = fields[1];
Expand Down

0 comments on commit ac58bc2

Please sign in to comment.