Whamcloud - gitweb
e2fsck: add portability fallback in case getpwuid_r is not present
authorTheodore Ts'o <tytso@mit.edu>
Thu, 5 Apr 2012 22:16:50 +0000 (15:16 -0700)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 5 Apr 2012 22:16:50 +0000 (15:16 -0700)
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
configure
configure.in
e2fsck/logfile.c
lib/config.h.in

index 8cb332c..aae5e60 100755 (executable)
--- a/configure
+++ b/configure
@@ -10893,7 +10893,7 @@ if test "$ac_res" != no; then :
 fi
 
 fi
-for ac_func in         __secure_getenv         backtrace       blkid_probe_get_topology        chflags         fallocate       fallocate64     fchown  fdatasync       fstat64         ftruncate64     getdtablesize   getmntinfo      getrlimit       getrusage       jrand48         llseek  lseek64         mallinfo        mbstowcs        memalign        mmap    msync   nanosleep       open64  pathconf        posix_fadvise   posix_memalign  prctl   quotactl        setresgid       setresuid       srandom         strcasecmp      strdup  strnlen         strptime        strtoull        sync_file_range         sysconf         usleep  utime   valloc
+for ac_func in         __secure_getenv         backtrace       blkid_probe_get_topology        chflags         fallocate       fallocate64     fchown  fdatasync       fstat64         ftruncate64     getdtablesize   getmntinfo      getpwuid_r      getrlimit       getrusage       jrand48         llseek  lseek64         mallinfo        mbstowcs        memalign        mmap    msync   nanosleep       open64  pathconf        posix_fadvise   posix_memalign  prctl   quotactl        setresgid       setresuid       srandom         strcasecmp      strdup  strnlen         strptime        strtoull        sync_file_range         sysconf         usleep  utime   valloc
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
index 32d5768..e458a7d 100644 (file)
@@ -968,6 +968,7 @@ AC_CHECK_FUNCS(m4_flatten([
        ftruncate64
        getdtablesize
        getmntinfo
+       getpwuid_r
        getrlimit
        getrusage
        jrand48
index 76ae52d..3bb15cd 100644 (file)
@@ -126,7 +126,11 @@ static void expand_percent_expression(e2fsck_t ctx, char ch,
                strcpy(buf, "tytso");
                break;
 #else
+#ifdef HAVE_GETPWUID_R
                getpwuid_r(getuid(), &pw_struct, buf, sizeof(buf), &pw);
+#else
+               pw = getpwuid(getuid());
+#endif
                if (pw)
                        append_string(s, pw->pw_name, 0);
                return;
index f69eebe..bd57a47 100644 (file)
 /* Define to 1 if you have the `getpagesize' function. */
 #undef HAVE_GETPAGESIZE
 
+/* Define to 1 if you have the `getpwuid_r' function. */
+#undef HAVE_GETPWUID_R
+
 /* Define to 1 if you have the `getrlimit' function. */
 #undef HAVE_GETRLIMIT