From f6529a05a2f087cb57a7fe84f226fef3780728d0 Mon Sep 17 00:00:00 2001 From: Colin Harrison Date: Sat, 8 Oct 2011 14:39:07 +0100 Subject: Xming: Always remove temporary file used when invoking xkbcomp on Win32 When built for native Win32, pipe() & fork() aren't available, so we use a tempoary file and system() to invoke xkbcomp Ensure the temporary file is always removed. It was only being removed on most errors, not on success :S Also fix a couple of warnings which occur when built with WIN32 defined Signed-off-by: Jon TURNEY Reviewed-by: Jon TURNEY --- xkb/ddxList.c | 8 ++++++-- xkb/ddxLoad.c | 3 +++ 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'xkb') diff --git a/xkb/ddxList.c b/xkb/ddxList.c index 7de8efc15..e599f9169 100644 --- a/xkb/ddxList.c +++ b/xkb/ddxList.c @@ -44,7 +44,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #ifdef WIN32 /* from ddxLoad.c */ -extern const char* Win32TempDir(); +extern const char* Win32TempDir(void); extern int Win32System(const char *cmdline); #undef System #define System Win32System @@ -126,10 +126,11 @@ XkbDDXListComponent( DeviceIntPtr dev, char *file,*map,*tmp,*buf=NULL; FILE *in; Status status; -int rval; Bool haveDir; #ifdef WIN32 char tmpname[PATH_MAX]; +#else +int rval; #endif if ((list->pattern[what]==NULL)||(list->pattern[what][0]=='\0')) @@ -223,6 +224,9 @@ char tmpname[PATH_MAX]; buf = malloc(PATH_MAX * sizeof(char)); if (!buf) { fclose(in); +#ifdef WIN32 + unlink(tmpname); +#endif return BadAlloc; } while ((status==Success)&&((tmp=fgets(buf,PATH_MAX,in))!=NULL)) { diff --git a/xkb/ddxLoad.c b/xkb/ddxLoad.c index e1020358a..219d39c9a 100644 --- a/xkb/ddxLoad.c +++ b/xkb/ddxLoad.c @@ -267,6 +267,9 @@ XkbDDXCompileKeymapByNames( XkbDescPtr xkb, nameRtrn[nameRtrnLen-1]= '\0'; } free(buf); +#ifdef WIN32 + unlink(tmpname); +#endif return TRUE; } else -- cgit v1.2.3