From 141482616bd7019c763b54afad65601f291fb395 Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Fri, 4 Jun 2004 20:28:39 +0000 Subject: [PATCH] * prof_file.c (profile_open_file): Handle earlier (draft POSIX) specifications of getpwuid_r. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16408 dc483132-0cff-0310-8789-dd5450dbe970 --- src/util/profile/ChangeLog | 5 +++++ src/util/profile/prof_file.c | 12 ++++++++---- 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 + + * prof_file.c (profile_open_file): Handle earlier (draft POSIX) + specifications of getpwuid_r. + 2004-06-02 Ken Raeburn * 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; } -- 2.26.2