From: Ken Raeburn Date: Fri, 4 Jun 2004 20:28:39 +0000 (+0000) Subject: * prof_file.c (profile_open_file): Handle earlier (draft POSIX) specifications X-Git-Tag: krb5-1.4-beta1~364 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=141482616bd7019c763b54afad65601f291fb395;p=krb5.git * 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 --- 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; }