summaryrefslogtreecommitdiff
path: root/libc/pwd_grp/spent.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2003-06-27 10:43:43 +0000
committerEric Andersen <andersen@codepoet.org>2003-06-27 10:43:43 +0000
commit017c8132edae466e2892faec7ef6b834dfecbd34 (patch)
tree692c913a40337653fbcf9425e1551f2314ffc55b /libc/pwd_grp/spent.c
parent2e55dec21f3310e6868689fc1f4c4074ea3a35bb (diff)
Yet more cleanup for the reentrant pwd/grp functions so they
should now actually be doing the right thing
Diffstat (limited to 'libc/pwd_grp/spent.c')
-rw-r--r--libc/pwd_grp/spent.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libc/pwd_grp/spent.c b/libc/pwd_grp/spent.c
index b281072f4..734854b24 100644
--- a/libc/pwd_grp/spent.c
+++ b/libc/pwd_grp/spent.c
@@ -62,12 +62,14 @@ void endspent(void)
}
int getspent_r (struct spwd *spwd, char *buff,
- size_t buflen, struct spwd **crap)
+ size_t buflen, struct spwd **result)
{
int ret;
LOCK;
+ *result = NULL;
if (spwd_fd != -1 && (ret=__getspent_r(spwd, buff, buflen, spwd_fd)) == 0) {
UNLOCK;
+ *result = spwd;
return 0;
}
UNLOCK;
@@ -79,9 +81,10 @@ struct spwd *getspent(void)
int ret;
static char line_buff[PWD_BUFFER_SIZE];
static struct spwd spwd;
+ struct spwd *result;
LOCK;
- if ((ret=getspent_r(&spwd, line_buff, sizeof(line_buff), NULL)) == 0) {
+ if ((ret=getspent_r(&spwd, line_buff, sizeof(line_buff), &result)) == 0) {
UNLOCK;
return &spwd;
}