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/getpwnam.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/getpwnam.c')
-rw-r--r-- | libc/pwd_grp/getpwnam.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libc/pwd_grp/getpwnam.c b/libc/pwd_grp/getpwnam.c index 6f041e2d8..7e81fa081 100644 --- a/libc/pwd_grp/getpwnam.c +++ b/libc/pwd_grp/getpwnam.c @@ -42,6 +42,8 @@ int getpwnam_r (const char *name, struct passwd *password, int ret; int passwd_fd; + *result = NULL; + if (name == NULL) { return EINVAL; } @@ -54,6 +56,7 @@ int getpwnam_r (const char *name, struct passwd *password, if (!strcmp(password->pw_name, name)) { *result=password; close(passwd_fd); + *result = password; return 0; } } @@ -66,7 +69,8 @@ struct passwd *getpwnam(const char *name) { int ret; static char line_buff[PWD_BUFFER_SIZE]; - static struct passwd pwd, *result; + static struct passwd pwd; + struct passwd *result; LOCK; if ((ret=getpwnam_r(name, &pwd, line_buff, sizeof(line_buff), &result)) == 0) { |