Commit cffb7601 authored by Duncan Coutts's avatar Duncan Coutts Committed by Ian Lynagh

Drop ".exe" exetention from eventlog file name

Fixes ticket #5472
parent 7b594a5d
......@@ -196,8 +196,22 @@ initEventLogging(void)
{
StgWord8 t, c;
nat n_caps;
char *prog;
event_log_filename = stgMallocBytes(strlen(prog_name)
prog = stgMallocBytes(strlen(prog_name) + 1, "initEventLogging");
strcpy(prog, prog_name);
#ifdef mingw32_HOST_OS
// on Windows, drop the .exe suffix if there is one
{
char *suff;
suff = strrchr(prog,'.');
if (suff != NULL && !strcmp(suff,".exe")) {
*suff = '\0';
}
}
#endif
event_log_filename = stgMallocBytes(strlen(prog)
+ 10 /* .%d */
+ 10 /* .eventlog */,
"initEventLogging");
......@@ -208,14 +222,15 @@ initEventLogging(void)
if (event_log_pid == -1) { // #4512
// Single process
sprintf(event_log_filename, "%s.eventlog", prog_name);
sprintf(event_log_filename, "%s.eventlog", prog);
event_log_pid = getpid();
} else {
// Forked process, eventlog already started by the parent
// before fork
event_log_pid = getpid();
sprintf(event_log_filename, "%s.%d.eventlog", prog_name, event_log_pid);
sprintf(event_log_filename, "%s.%d.eventlog", prog, event_log_pid);
}
stgFree(prog);
/* Open event log file for writing. */
if ((event_log_file = fopen(event_log_filename, "wb")) == NULL) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment