diff --git a/lib/pwdutils.c b/lib/pwdutils.c index 641a9da40..1c1f13e92 100644 --- a/lib/pwdutils.c +++ b/lib/pwdutils.c @@ -3,6 +3,7 @@ * it what you wish. */ #include +#include #include "c.h" #include "pwdutils.h" @@ -17,8 +18,8 @@ struct passwd *xgetpwnam(const char *username, char **pwdbuf) struct passwd *pwd = NULL, *res = NULL; int rc; - if (!pwdbuf || !username) - return NULL; + assert(pwdbuf); + assert(username); *pwdbuf = xmalloc(UL_GETPW_BUFSIZ); pwd = xcalloc(1, sizeof(struct passwd)); @@ -49,8 +50,8 @@ struct group *xgetgrnam(const char *groupname, char **grpbuf) struct group *grp = NULL, *res = NULL; int rc; - if (!grpbuf || !groupname) - return NULL; + assert(grpbuf); + assert(groupname); *grpbuf = xmalloc(UL_GETPW_BUFSIZ); grp = xcalloc(1, sizeof(struct group)); @@ -77,8 +78,7 @@ struct passwd *xgetpwuid(uid_t uid, char **pwdbuf) struct passwd *pwd = NULL, *res = NULL; int rc; - if (!pwdbuf) - return NULL; + assert(pwdbuf); *pwdbuf = xmalloc(UL_GETPW_BUFSIZ); pwd = xcalloc(1, sizeof(struct passwd));