summaryrefslogtreecommitdiffstats
path: root/src/pwcache.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pwcache.c')
-rw-r--r--src/pwcache.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/pwcache.c b/src/pwcache.c
index 0e2f5c1..fa19dad 100644
--- a/src/pwcache.c
+++ b/src/pwcache.c
@@ -2,16 +2,14 @@
// SPDX-License-Identifier: 0BSD
#include "pwcache.h"
+
#include "alloc.h"
-#include "config.h"
-#include "darray.h"
#include "trie.h"
+
#include <errno.h>
#include <grp.h>
#include <pwd.h>
#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
/** Represents cache hits for negative results. */
static void *MISSING = &MISSING;
@@ -91,7 +89,7 @@ struct bfs_users *bfs_users_new(void) {
static void *bfs_getpwnam_impl(const void *key, void *ptr, size_t bufsize) {
struct bfs_passwd *storage = ptr;
- struct passwd *ret;
+ struct passwd *ret = NULL;
errno = getpwnam_r(key, &storage->pwd, storage->buf, bufsize, &ret);
return ret;
}
@@ -110,7 +108,7 @@ static void *bfs_getpwuid_impl(const void *key, void *ptr, size_t bufsize) {
const uid_t *uid = key;
struct bfs_passwd *storage = ptr;
- struct passwd *ret;
+ struct passwd *ret = NULL;
errno = getpwuid_r(*uid, &storage->pwd, storage->buf, bufsize, &ret);
return ret;
}
@@ -172,7 +170,7 @@ struct bfs_groups *bfs_groups_new(void) {
static void *bfs_getgrnam_impl(const void *key, void *ptr, size_t bufsize) {
struct bfs_group *storage = ptr;
- struct group *ret;
+ struct group *ret = NULL;
errno = getgrnam_r(key, &storage->grp, storage->buf, bufsize, &ret);
return ret;
}
@@ -191,7 +189,7 @@ static void *bfs_getgrgid_impl(const void *key, void *ptr, size_t bufsize) {
const gid_t *gid = key;
struct bfs_group *storage = ptr;
- struct group *ret;
+ struct group *ret = NULL;
errno = getgrgid_r(*gid, &storage->grp, storage->buf, bufsize, &ret);
return ret;
}