summaryrefslogtreecommitdiffstats
path: root/src/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/util')
-rw-r--r--src/util/profile/ChangeLog5
-rw-r--r--src/util/profile/prof_file.c12
2 files changed, 13 insertions, 4 deletions
diff --git a/src/util/profile/ChangeLog b/src/util/profile/ChangeLog
index c9ee1cd4a..ca3af0bff 100644
--- a/src/util/profile/ChangeLog
+++ b/src/util/profile/ChangeLog
@@ -1,3 +1,8 @@
+2004-06-03 Ken Raeburn <raeburn@mit.edu>
+
+ * prof_file.c (profile_open_file): Handle earlier (draft POSIX)
+ specifications of getpwuid_r.
+
2004-06-02 Ken Raeburn <raeburn@mit.edu>
* configure.in: Check for getpwuid_r.
diff --git a/src/util/profile/prof_file.c b/src/util/profile/prof_file.c
index c0cbbbddf..875432873 100644
--- a/src/util/profile/prof_file.c
+++ b/src/util/profile/prof_file.c
@@ -150,13 +150,17 @@ errcode_t profile_open_file(const_profile_filespec_t filespec,
#endif
uid = getuid();
-#ifdef HAVE_GETPWUID_R
+#ifndef HAVE_GETPWUID_R
+ pw = getpwuid(uid);
+#elif defined(GETPWUID_R_4_ARGS)
+ /* earlier POSIX drafts */
+ pw = getpwuid_r(uid, &pwx, pwbuf, sizeof(pwbuf));
+#else
+ /* POSIX */
if (getpwuid_r(uid, &pwx, pwbuf, sizeof(pwbuf), &pw) != 0)
/* Probably already null, but let's make sure. */
pw = NULL;
-#else
- pw = getpwuid(uid);
-#endif
+#endif /* getpwuid variants */
if (pw != NULL && pw->pw_dir[0] != 0)
home_env = pw->pw_dir;
}