From: Theodore Ts'o Date: Thu, 5 Apr 2012 22:16:50 +0000 (-0700) Subject: e2fsck: add portability fallback in case getpwuid_r is not present X-Git-Tag: v1.42.3~38 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=25ff7725cc934fff9bca44add76b5557c71e4a4a;p=thirdparty%2Fe2fsprogs.git e2fsck: add portability fallback in case getpwuid_r is not present Signed-off-by: "Theodore Ts'o" --- diff --git a/configure b/configure index 8cb332cd5..aae5e602a 100755 --- 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" diff --git a/configure.in b/configure.in index 32d57684e..e458a7d68 100644 --- a/configure.in +++ b/configure.in @@ -968,6 +968,7 @@ AC_CHECK_FUNCS(m4_flatten([ ftruncate64 getdtablesize getmntinfo + getpwuid_r getrlimit getrusage jrand48 diff --git a/e2fsck/logfile.c b/e2fsck/logfile.c index 76ae52d1b..3bb15cd3f 100644 --- a/e2fsck/logfile.c +++ b/e2fsck/logfile.c @@ -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; diff --git a/lib/config.h.in b/lib/config.h.in index f69eebe75..bd57a471b 100644 --- a/lib/config.h.in +++ b/lib/config.h.in @@ -145,6 +145,9 @@ /* 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