diff options
author | Eric Andersen <andersen@codepoet.org> | 2003-06-27 10:43:43 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2003-06-27 10:43:43 +0000 |
commit | 017c8132edae466e2892faec7ef6b834dfecbd34 (patch) | |
tree | 692c913a40337653fbcf9425e1551f2314ffc55b /libc/pwd_grp/getspuid.c | |
parent | 2e55dec21f3310e6868689fc1f4c4074ea3a35bb (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/getspuid.c')
-rw-r--r-- | libc/pwd_grp/getspuid.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libc/pwd_grp/getspuid.c b/libc/pwd_grp/getspuid.c index 3fa7fb5a1..b25fddb49 100644 --- a/libc/pwd_grp/getspuid.c +++ b/libc/pwd_grp/getspuid.c @@ -41,11 +41,14 @@ int getspuid_r (uid_t uid, struct spwd *spwd, char pwd_buff[PWD_BUFFER_SIZE]; struct passwd password; + *result = NULL; ret = getpwuid_r(uid, &password, pwd_buff, sizeof(pwd_buff), NULL); if (ret != 0) return ret; - return getspnam_r(password.pw_name, spwd, buff, buflen, result); + ret = getspnam_r(password.pw_name, spwd, buff, buflen, result); + *result = spwd; + return ret; } struct spwd *getspuid(uid_t uid) @@ -53,9 +56,10 @@ struct spwd *getspuid(uid_t uid) int ret; static char line_buff[PWD_BUFFER_SIZE]; static struct spwd spwd; + struct spwd *result; LOCK; - if ((ret=getspuid_r(uid, &spwd, line_buff, sizeof(line_buff), NULL)) == 0) { + if ((ret=getspuid_r(uid, &spwd, line_buff, sizeof(line_buff), &result)) == 0) { UNLOCK; return &spwd; } |