* configure.in: Check for getpwuid_r.
* prof_file.c (profile_open_file) [HAVE_PWD_H && HAVE_GETPWUID_R]: Use
getpwuid_r if available.
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16395
dc483132-0cff-0310-8789-
dd5450dbe970
+2004-06-02 Ken Raeburn <raeburn@mit.edu>
+
+ * configure.in: Check for getpwuid_r.
+ * prof_file.c (profile_open_file) [HAVE_PWD_H && HAVE_GETPWUID_R]:
+ Use getpwuid_r if available.
+
2004-05-24 Ezra Peisach <epeisach@mit.edu>
* configure.in: When generating prtest, use AC_CONFIG_FILES
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
AC_CHECK_HEADERS(unistd.h stdlib.h pwd.h)
-AC_CHECK_FUNCS(stat access strdup)
+AC_CHECK_FUNCS(stat access strdup getpwuid_r)
AC_PROG_AWK
KRB5_BUILD_LIBOBJS
KRB5_BUILD_PROGRAM
if (home_env == NULL) {
uid_t uid;
struct passwd *pw;
+#ifdef HAVE_GETPWUID_R
+ struct passwd pwx;
+ char pwbuf[BUFSIZ];
+#endif
uid = getuid();
+#ifdef HAVE_GETPWUID_R
+ 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
if (pw != NULL && pw->pw_dir[0] != 0)
home_env = pw->pw_dir;
}