summaryrefslogtreecommitdiff
path: root/xkb
diff options
context:
space:
mode:
authorAlexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de>2004-12-24 14:40:28 +0000
committerAlexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de>2004-12-24 14:40:28 +0000
commit83e13e21c8d9a3b54cae2ecc2943be3316659870 (patch)
tree79501c7d6f2eb423ced1dbbf4222d245837d6d9d /xkb
parent106703edf67139fa52f6810f9ced0ce5ba86a3cd (diff)
Print error message if CreateProcess fails Simplify popen simulation code
for WIN32 Remove temporary file after executing xkbcomp
Diffstat (limited to 'xkb')
-rw-r--r--xkb/ddxLoad.c38
1 files changed, 27 insertions, 11 deletions
diff --git a/xkb/ddxLoad.c b/xkb/ddxLoad.c
index e5ef0bfeb..d39a9d48b 100644
--- a/xkb/ddxLoad.c
+++ b/xkb/ddxLoad.c
@@ -110,8 +110,28 @@ Win32System(const char *cmdline)
if (!CreateProcess(NULL, cmd, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi))
{
- xfree(cmd);
- return -1;
+ LPVOID buffer;
+ if (!FormatMessage(
+ FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL,
+ GetLastError(),
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ (LPTSTR) &buffer,
+ 0,
+ NULL ))
+ {
+ ErrorF("Starting '%s' failed!\n", cmdline);
+ }
+ else
+ {
+ ErrorF("Starting '%s' failed: %s", cmdline, (char *)buffer);
+ LocalFree(buffer);
+ }
+
+ xfree(cmd);
+ return -1;
}
// Wait until child process exits.
WaitForSingleObject( pi.hProcess, INFINITE );
@@ -374,7 +394,7 @@ int i;
#ifndef WIN32
if (Pclose(out)==0)
#else
- if (fclose(out)==0)
+ if (fclose(out)==0 && System(buf) >= 0)
#endif
{
#ifdef DEBUG_CMD
@@ -383,11 +403,6 @@ int i;
XkbWriteXKBKeymapForNames(stderr,names,NULL,xkb,want,need);
ErrorF("end xkbcomp input\n");
#endif
-#ifdef WIN32
- if (System(buf) < 0)
- ErrorF("Could not invoke keymap compiler\n");
- else {
-#endif
if (nameRtrn) {
strncpy(nameRtrn,keymap,nameRtrnLen);
nameRtrn[nameRtrnLen-1]= '\0';
@@ -417,14 +432,15 @@ int i;
}
#endif
return True;
-#ifdef WIN32
- }
-#endif
}
#ifdef DEBUG
else
ErrorF("Error compiling keymap (%s)\n",keymap);
#endif
+#ifdef WIN32
+ /* remove the temporary file */
+ unlink(tmpname);
+#endif
}
#ifdef DEBUG
else {