summaryrefslogtreecommitdiff
path: root/user
diff options
context:
space:
mode:
authorPaul Querna <pquerna@apache.org>2005-07-19 12:26:24 +0000
committerPaul Querna <pquerna@apache.org>2005-07-19 12:26:24 +0000
commitf0fe69e990cbfc2b5cbe1d1aed0c85e2a0667d3e (patch)
tree487056e9626904135bec11db6312a9ec87068e71 /user
parent935d80c73f103ee1b9f0c39e799c71008a381a4c (diff)
downloadapr-f0fe69e990cbfc2b5cbe1d1aed0c85e2a0667d3e.tar.gz
As suggested by Joe on dev@apr, don't return errno, since its not correct according to the specs.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@219667 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'user')
-rw-r--r--user/unix/userinfo.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/user/unix/userinfo.c b/user/unix/userinfo.c
index 829a856be..e049f5e9b 100644
--- a/user/unix/userinfo.c
+++ b/user/unix/userinfo.c
@@ -114,13 +114,22 @@ APR_DECLARE(apr_status_t) apr_uid_name_get(char **username, apr_uid_t userid,
#if APR_HAS_THREADS && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && defined(HAVE_GETPWUID_R)
struct passwd pwd;
char pwbuf[PWBUF_SIZE];
+ apr_status_t rv;
+
+ rv = getpwuid_r(userid, &pwd, pwbuf, sizeof(pwbuf), &pw);
+ if (rv) {
+ return rv;
+ }
+
+ if (pw == NULL) {
+ return APR_ENOENT;
+ }
- if (getpwuid_r(userid, &pwd, pwbuf, sizeof(pwbuf), &pw) || pw == NULL) {
#else
if ((pw = getpwuid(userid)) == NULL) {
-#endif
return errno;
}
+#endif
*username = apr_pstrdup(p, pw->pw_name);
return APR_SUCCESS;
}