* prof_file.c (profile_open_file): Handle earlier (draft POSIX) specifications
authorKen Raeburn <raeburn@mit.edu>
Fri, 4 Jun 2004 20:28:39 +0000 (20:28 +0000)
committerKen Raeburn <raeburn@mit.edu>
Fri, 4 Jun 2004 20:28:39 +0000 (20:28 +0000)
of getpwuid_r.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16408 dc483132-0cff-0310-8789-dd5450dbe970

src/util/profile/ChangeLog
src/util/profile/prof_file.c

index c9ee1cd4abc81c59c0698ae6d45228c1f70230d7..ca3af0bff71ad695fc162b9b00ac88dcafdec5c3 100644 (file)
@@ -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.
index c0cbbbddf9c5eb19d590537f288ee9235858a64e..8754328730b56771988c686566c3f62bffe23347 100644 (file)
@@ -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;
                }