From 017c8132edae466e2892faec7ef6b834dfecbd34 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Fri, 27 Jun 2003 10:43:43 +0000 Subject: Yet more cleanup for the reentrant pwd/grp functions so they should now actually be doing the right thing --- libc/pwd_grp/sgetspent.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'libc/pwd_grp/sgetspent.c') diff --git a/libc/pwd_grp/sgetspent.c b/libc/pwd_grp/sgetspent.c index 5f018b9f1..d2e2ca71a 100644 --- a/libc/pwd_grp/sgetspent.c +++ b/libc/pwd_grp/sgetspent.c @@ -33,9 +33,13 @@ static pthread_mutex_t mylock = PTHREAD_MUTEX_INITIALIZER; #endif int sgetspent_r (const char *string, struct spwd *spwd, - char *buff, size_t buflen, struct spwd **crap) + char *buff, size_t buflen, struct spwd **result) { - return(__sgetspent_r(string, spwd, buff, buflen)); + int ret; + *result = NULL; + ret = __sgetspent_r(string, spwd, buff, buflen); + *result = spwd; + return ret; } struct spwd *sgetspent(const char *string) @@ -43,9 +47,10 @@ struct spwd *sgetspent(const char *string) int ret; static char line_buff[PWD_BUFFER_SIZE]; static struct spwd spwd; + struct spwd *result; LOCK; - if ((ret = sgetspent_r(string, &spwd, line_buff, sizeof(line_buff), NULL)) == 0) { + if ((ret = sgetspent_r(string, &spwd, line_buff, sizeof(line_buff), &result)) == 0) { UNLOCK; return &spwd; } -- cgit v1.2.3