Added configure check for getpwuid.

This commit is contained in:
Alexandre Julliard 2002-07-01 18:17:30 +00:00
parent 2f4ae7ba2c
commit 142dab8c81
4 changed files with 14 additions and 1 deletions

2
configure vendored
View File

@ -11152,6 +11152,7 @@ fi
for ac_func in \ for ac_func in \
@ -11174,6 +11175,7 @@ for ac_func in \
getpagesize \ getpagesize \
getprotobyname \ getprotobyname \
getprotobynumber \ getprotobynumber \
getpwuid \
getservbyport \ getservbyport \
getsockopt \ getsockopt \
inet_network \ inet_network \

View File

@ -860,6 +860,7 @@ AC_CHECK_FUNCS(\
getpagesize \ getpagesize \
getprotobyname \ getprotobyname \
getprotobynumber \ getprotobynumber \
getpwuid \
getservbyport \ getservbyport \
getsockopt \ getsockopt \
inet_network \ inet_network \

View File

@ -134,6 +134,9 @@
/* Define to 1 if you have the `getprotobynumber' function. */ /* Define to 1 if you have the `getprotobynumber' function. */
#undef HAVE_GETPROTOBYNUMBER #undef HAVE_GETPROTOBYNUMBER
/* Define to 1 if you have the `getpwuid' function. */
#undef HAVE_GETPWUID
/* Define to 1 if you have the `getservbyport' function. */ /* Define to 1 if you have the `getservbyport' function. */
#undef HAVE_GETSERVBYPORT #undef HAVE_GETSERVBYPORT

View File

@ -91,11 +91,14 @@ inline static void remove_trailing_slashes( char *path )
static void init_paths(void) static void init_paths(void)
{ {
struct stat st; struct stat st;
char uid_str[32], *p; char *p;
const char *home = getenv( "HOME" ); const char *home = getenv( "HOME" );
const char *user = NULL; const char *user = NULL;
const char *prefix = getenv( "WINEPREFIX" ); const char *prefix = getenv( "WINEPREFIX" );
#ifdef HAVE_GETPWUID
char uid_str[32];
struct passwd *pwd = getpwuid( getuid() ); struct passwd *pwd = getpwuid( getuid() );
if (pwd) if (pwd)
@ -108,6 +111,10 @@ static void init_paths(void)
sprintf( uid_str, "%d", getuid() ); sprintf( uid_str, "%d", getuid() );
user = uid_str; 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 */ /* build config_dir */