From 142dab8c8150c428db6960788f31ab7d97184d1e Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 1 Jul 2002 18:17:30 +0000 Subject: [PATCH] Added configure check for getpwuid. --- configure | 2 ++ configure.ac | 1 + include/config.h.in | 3 +++ library/config.c | 9 ++++++++- 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 2b9eedb2ce3..ebabfb92660 100755 --- a/configure +++ b/configure @@ -11154,6 +11154,7 @@ fi + for ac_func in \ __libc_fork \ _lwp_create \ @@ -11174,6 +11175,7 @@ for ac_func in \ getpagesize \ getprotobyname \ getprotobynumber \ + getpwuid \ getservbyport \ getsockopt \ inet_network \ diff --git a/configure.ac b/configure.ac index 21a93835edd..6a250ea9f0a 100644 --- a/configure.ac +++ b/configure.ac @@ -860,6 +860,7 @@ AC_CHECK_FUNCS(\ getpagesize \ getprotobyname \ getprotobynumber \ + getpwuid \ getservbyport \ getsockopt \ inet_network \ diff --git a/include/config.h.in b/include/config.h.in index a5e5627daf7..083c1f4bb9c 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -134,6 +134,9 @@ /* Define to 1 if you have the `getprotobynumber' function. */ #undef HAVE_GETPROTOBYNUMBER +/* Define to 1 if you have the `getpwuid' function. */ +#undef HAVE_GETPWUID + /* Define to 1 if you have the `getservbyport' function. */ #undef HAVE_GETSERVBYPORT diff --git a/library/config.c b/library/config.c index 80a68942dae..54a255de6f4 100644 --- a/library/config.c +++ b/library/config.c @@ -91,11 +91,14 @@ inline static void remove_trailing_slashes( char *path ) static void init_paths(void) { struct stat st; - char uid_str[32], *p; + char *p; const char *home = getenv( "HOME" ); const char *user = NULL; const char *prefix = getenv( "WINEPREFIX" ); + +#ifdef HAVE_GETPWUID + char uid_str[32]; struct passwd *pwd = getpwuid( getuid() ); if (pwd) @@ -108,6 +111,10 @@ static void init_paths(void) sprintf( uid_str, "%d", getuid() ); user = uid_str; } +#else /* HAVE_GETPWUID */ + if (!(user = getenv( "USER" ))) + fatal_error( "cannot determine your user name, set the USER environment variable\n" ); +#endif /* HAVE_GETPWUID */ /* build config_dir */ -- 2.11.4.GIT