From f62b48712ee2be158a7ca9667784991f847edf1c Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Sun, 25 Apr 1999 12:39:33 +0000 Subject: [PATCH] Use $HOME instead of getpwuid for user's home directory. --- graphics/x11drv/xfont.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/graphics/x11drv/xfont.c b/graphics/x11drv/xfont.c index f6c2e7c00d3..bf18b88bba1 100644 --- a/graphics/x11drv/xfont.c +++ b/graphics/x11drv/xfont.c @@ -20,7 +20,6 @@ #include #include #include -#include #include #include #include @@ -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 );