diff --git a/configure b/configure index 2b9eedb2ce3..ebabfb92660 100755 --- a/configure +++ b/configure @@ -11152,6 +11152,7 @@ fi + for ac_func in \ @@ -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 */