diff options
author | Rich Felker <dalias@aerifal.cx> | 2015-03-15 23:33:59 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2015-03-15 23:33:59 -0400 |
commit | 49d1e7f93129cdcc2ab0cc91832b8a29ccd1570d (patch) | |
tree | 7a852d0cf7297b73e6eedc6680f79234c6d290ea /src/passwd/getgr_a.c | |
parent | 2894a44b40e460fc4112988407818439f2e9672d (diff) | |
download | musl-49d1e7f93129cdcc2ab0cc91832b8a29ccd1570d.tar.gz |
simplify nscd lookup code for alt passwd/group backends
previously, a sentinel value of (FILE *)-1 was used to inform the
caller of __nscd_query that nscd is not in use. aside from being an
ugly hack, this resulted in duplicate code paths for two logically
equivalent cases: no nscd, and "not found" result from nscd.
now, __nscd_query simply skips closing the socket and returns a valid
FILE pointer when nscd is not in use, and produces a fake "not found"
response header. the caller is then responsible for closing the socket
just like it would do if it had gotten a real "not found" response.
Diffstat (limited to 'src/passwd/getgr_a.c')
-rw-r--r-- | src/passwd/getgr_a.c | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/src/passwd/getgr_a.c b/src/passwd/getgr_a.c index 7738c3c3..afeb1ece 100644 --- a/src/passwd/getgr_a.c +++ b/src/passwd/getgr_a.c @@ -63,7 +63,6 @@ int __getgr_a(const char *name, gid_t gid, struct group *gr, char **buf, size_t f = __nscd_query(req, key, groupbuf, sizeof groupbuf, &swap); if (!f) { rv = errno; goto done; } - if (f == (FILE*)-1) { rv = 0; goto done; } if (!groupbuf[GRFOUND]) { rv = 0; goto cleanup_f; } |