X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Ftrace%2Flib_trace.c;h=34973daae8294f5394ecf096f938dae18f11c1da;hp=3e29f326f8f1083b43f5769d1a6acd43fc1a986c;hb=c13e57306ae5c4431fddd0fe856c3bcae6aeeb2c;hpb=7a27c7d49c2e8b4a1ecbe85b4423d647cbc75ea5 diff --git a/ncurses/trace/lib_trace.c b/ncurses/trace/lib_trace.c index 3e29f326..34973daa 100644 --- a/ncurses/trace/lib_trace.c +++ b/ncurses/trace/lib_trace.c @@ -46,7 +46,7 @@ #include -MODULE_ID("$Id: lib_trace.c,v 1.61 2007/04/21 23:06:07 tom Exp $") +MODULE_ID("$Id: lib_trace.c,v 1.62 2007/07/14 19:32:54 tom Exp $") NCURSES_EXPORT_VAR(unsigned) _nc_tracing = 0; /* always define this */ @@ -65,11 +65,14 @@ trace(const unsigned int tracelevel) const char *mode = _nc_globals.init_trace ? "ab" : "wb"; if (TracePath[0] == '\0') { - if (getcwd(TracePath, sizeof(TracePath) - 10) == 0) { + if (getcwd(TracePath, sizeof(TracePath) - 12) == 0) { perror("curses: Can't get working directory"); exit(EXIT_FAILURE); } strcat(TracePath, "/trace"); + if (_nc_is_dir_path(TracePath)) { + strcat(TracePath, ".log"); + } } _nc_globals.init_trace = TRUE;