Repository : ssh://darcs.haskell.org//srv/darcs/ghc On branch : master
http://hackage.haskell.org/trac/ghc/changeset/cffb7601d8fa4c4939a08763564dda239fc80dab >--------------------------------------------------------------- commit cffb7601d8fa4c4939a08763564dda239fc80dab Author: Duncan Coutts <[email protected]> Date: Mon Nov 21 11:32:15 2011 +0000 Drop ".exe" exetention from eventlog file name Fixes ticket #5472 >--------------------------------------------------------------- rts/eventlog/EventLog.c | 21 ++++++++++++++++++--- 1 files changed, 18 insertions(+), 3 deletions(-) diff --git a/rts/eventlog/EventLog.c b/rts/eventlog/EventLog.c index 9547e7c..2e2209d 100644 --- a/rts/eventlog/EventLog.c +++ b/rts/eventlog/EventLog.c @@ -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) { _______________________________________________ Cvs-ghc mailing list [email protected] http://www.haskell.org/mailman/listinfo/cvs-ghc
