Use $HOME instead of getpwuid for user's home directory.

This commit is contained in:
Alexandre Julliard 1999-04-25 12:39:33 +00:00
parent c7a8dde118
commit f62b48712e
1 changed files with 4 additions and 7 deletions

View File

@ -20,7 +20,6 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <pwd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
@ -1257,20 +1256,18 @@ static void XFONT_LoadPenalties( char** buffer, int *buf_size )
*/
static char* XFONT_UserMetricsCache( char* buffer, int* buf_size )
{
struct passwd* pwd;
char* pchDisplay;
char* pchDisplay, *home;
pchDisplay = getenv( "DISPLAY" );
if( !pchDisplay ) pchDisplay = "0";
pwd = getpwuid(getuid());
if( pwd && pwd->pw_dir )
if ((home = getenv( "HOME" )) != NULL)
{
int i = strlen( pwd->pw_dir ) + strlen( INIWinePrefix ) +
int i = strlen( home ) + strlen( INIWinePrefix ) +
strlen( INIFontMetrics ) + strlen( pchDisplay ) + 2;
if( i > *buf_size )
buffer = (char*) HeapReAlloc( SystemHeap, 0, buffer, *buf_size = i );
strcpy( buffer, pwd->pw_dir );
strcpy( buffer, home );
strcat( buffer, INIWinePrefix );
strcat( buffer, INIFontMetrics );
strcat( buffer, pchDisplay );