X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Ftrace%2Flib_trace.c;h=80ab6e1224409a9bb8266808ed1451e0d9139d3f;hp=4567054a9fd30120b47309d576e258d41033c9d1;hb=989279b4d718c26ccc7bad2dfba099e4788f5da3;hpb=5461fc336d03fbfea6b85ac21c6d49c528f6752d diff --git a/ncurses/trace/lib_trace.c b/ncurses/trace/lib_trace.c index 4567054a..80ab6e12 100644 --- a/ncurses/trace/lib_trace.c +++ b/ncurses/trace/lib_trace.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2013,2016 Free Software Foundation, Inc. * + * Copyright (c) 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -47,7 +47,7 @@ #include -MODULE_ID("$Id: lib_trace.c,v 1.85 2016/12/31 13:50:06 tom Exp $") +MODULE_ID("$Id: lib_trace.c,v 1.86 2017/01/14 17:53:42 tom Exp $") NCURSES_EXPORT_VAR(unsigned) _nc_tracing = 0; /* always define this */ @@ -87,6 +87,7 @@ NCURSES_EXPORT_VAR(long) _nc_outchars = 0; #define MyFP _nc_globals.trace_fp #define MyFD _nc_globals.trace_fd +#define MyInit _nc_globals.trace_opened #define MyPath _nc_globals.trace_fname #define MyLevel _nc_globals.trace_level #define MyNested _nc_globals.nested_tracef @@ -95,6 +96,7 @@ NCURSES_EXPORT(void) trace(const unsigned int tracelevel) { if ((MyFP == 0) && tracelevel) { + MyInit = TRUE; if (MyFD >= 0) { MyFP = fdopen(MyFD, "wb"); } else { @@ -160,7 +162,7 @@ _nc_va_tracef(const char *fmt, va_list ap) #ifdef TRACE /* verbose-trace in the command-line utilities relies on this */ - if (fp == 0 && _nc_tracing >= DEBUG_LEVEL(1)) + if (fp == 0 && !MyInit && _nc_tracing >= DEBUG_LEVEL(1)) fp = stderr; #endif