summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Trawick <trawick@apache.org>2002-07-01 16:44:10 +0000
committerJeff Trawick <trawick@apache.org>2002-07-01 16:44:10 +0000
commit2cc8a13cc1020aaf77ae3291b9be6cccbdf2367f (patch)
tree4d60591fe9ec7af21f088aafb23a2a4bb5d06e4c
parent330a4389798461ebdc58cb68ba95f53e71aa9596 (diff)
downloadapr-2cc8a13cc1020aaf77ae3291b9be6cccbdf2367f.tar.gz
Fix the userid functions on Irix to handle the way that Irix
reports a failure from getpwnam_r(). PR: 10095 Submitted by: Robert I. Cowles <ric@cs.uregina.ca>, Jeff Trawick git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@63543 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--CHANGES4
-rw-r--r--user/unix/userinfo.c3
2 files changed, 6 insertions, 1 deletions
diff --git a/CHANGES b/CHANGES
index 97f049dde..9e6051a1c 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,9 @@
Changes with APR b1
+ *) Fix the userid functions on Irix to handle the way that Irix
+ reports a failure from getpwnam_r(). PR 10095.
+ [Robert I. Cowles <ric@cs.uregina.ca>, Jeff Trawick]
+
*) apr_table_do() and apr_table_vdo() now return an int rather than
void to indicate whether or not any of its iterations returned 0.
[Cliff Woolley]
diff --git a/user/unix/userinfo.c b/user/unix/userinfo.c
index 603e4fa68..1455c8f5e 100644
--- a/user/unix/userinfo.c
+++ b/user/unix/userinfo.c
@@ -76,7 +76,8 @@ static apr_status_t getpwnam_safe(const char *username,
{
struct passwd *pwptr;
#if APR_HAS_THREADS && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && defined(HAVE_GETPWNAM_R)
- if (!getpwnam_r(username, pw, pwbuf, PWBUF_SIZE, &pwptr)) {
+ /* IRIX getpwnam_r() returns 0 and sets pwptr to NULL on failure */
+ if (!getpwnam_r(username, pw, pwbuf, PWBUF_SIZE, &pwptr) && pwptr) {
/* nothing extra to do on success */
#else
if ((pwptr = getpwnam(username)) != NULL) {