Skip to content

Commit

Permalink
lib/sgetspent.c: sgetspent(): Use NULL instead of 0 to mean a null po…
Browse files Browse the repository at this point in the history
…inter constant

Signed-off-by: Alejandro Colomar <[email protected]>
  • Loading branch information
alejandro-colomar authored and hallyn committed Mar 14, 2024
1 parent ae17e02 commit 9315168
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions lib/sgetspent.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 <sys/types.h>
#include <string.h>
Expand Down Expand Up @@ -48,7 +49,7 @@ sgetspent(const char *string)
fprintf (shadow_logfd,
"%s: Too long passwd entry encountered, file corruption?\n",
shadow_progname);
return 0; /* fail if too long */
return NULL; /* fail if too long */
}
strcpy (spwbuf, string);

Expand Down Expand Up @@ -78,7 +79,7 @@ sgetspent(const char *string)

if ( ((NULL != cp) && ('\0' != *cp)) ||
((i != FIELDS) && (i != OFIELDS)) ) {
return 0;
return NULL;
}

/*
Expand All @@ -99,7 +100,7 @@ sgetspent(const char *string)
spwd.sp_lstchg = -1;
} else if ( (getlong(fields[2], &spwd.sp_lstchg) == -1)
|| (spwd.sp_lstchg < 0)) {
return 0;
return NULL;
}

/*
Expand All @@ -110,7 +111,7 @@ sgetspent(const char *string)
spwd.sp_min = -1;
} else if ( (getlong(fields[3], &spwd.sp_min) == -1)
|| (spwd.sp_min < 0)) {
return 0;
return NULL;
}

/*
Expand All @@ -121,7 +122,7 @@ sgetspent(const char *string)
spwd.sp_max = -1;
} else if ( (getlong(fields[4], &spwd.sp_max) == -1)
|| (spwd.sp_max < 0)) {
return 0;
return NULL;
}

/*
Expand All @@ -146,7 +147,7 @@ sgetspent(const char *string)
spwd.sp_warn = -1;
} else if ( (getlong(fields[5], &spwd.sp_warn) == -1)
|| (spwd.sp_warn < 0)) {
return 0;
return NULL;
}

/*
Expand All @@ -158,7 +159,7 @@ sgetspent(const char *string)
spwd.sp_inact = -1;
} else if ( (getlong(fields[6], &spwd.sp_inact) == -1)
|| (spwd.sp_inact < 0)) {
return 0;
return NULL;
}

/*
Expand All @@ -170,7 +171,7 @@ sgetspent(const char *string)
spwd.sp_expire = -1;
} else if ( (getlong(fields[7], &spwd.sp_expire) == -1)
|| (spwd.sp_expire < 0)) {
return 0;
return NULL;
}

/*
Expand All @@ -181,12 +182,11 @@ sgetspent(const char *string)
if (fields[8][0] == '\0') {
spwd.sp_flag = SHADOW_SP_FLAG_UNSET;
} else if (getulong(fields[8], &spwd.sp_flag) == -1) {
return 0;
return NULL;
}

return (&spwd);
}
#else
extern int ISO_C_forbids_an_empty_translation_unit;
#endif

0 comments on commit 9315168

Please sign in to comment.