This is the mail archive of the
cygwin-apps@cygwin.com
mailing list for the Cygwin project.
[PATCH] Fixes for LogFile::exit()
- From: "Max Bowsher" <maxb at ukf dot net>
- To: <cygwin-apps at cygwin dot com>
- Date: Tue, 18 Mar 2003 08:22:06 -0000
- Subject: [PATCH] Fixes for LogFile::exit()
Index: LogFile.cc
===================================================================
RCS file: /home/max/cvsmirror/cygwin-apps-cvs/setup/LogFile.cc,v
retrieving revision 2.7
diff -u -p -r2.7 LogFile.cc
--- LogFile.cc 9 Mar 2003 01:22:43 -0000 2.7
+++ LogFile.cc 18 Mar 2003 08:14:48 -0000
@@ -123,11 +123,7 @@ LogFile::exit (int const exit_code)
AntiVirus::AtExit();
static int been_here = 0;
if (been_here)
-#ifndef _CYGWIN_
- ExitProcess (1);
-#else
- exit (1);
-#endif
+ ::exit (exit_code);
been_here = 1;
if (exit_msg)
@@ -140,11 +136,7 @@ LogFile::exit (int const exit_code)
{
log_save (i->level, i->key, i->append);
}
-#ifndef _CYGWIN_
- ExitProcess (exit_code);
-#else
- exit (1);
-#endif
+ ::exit (exit_code);
}
void
This patch addresses several issues.
1) _CYGWIN_ is *not* correct. The __CYGWIN__ define has *double* underscores
at each end.
2) This is fortunate, since otherwise this code would infinitely recurse: In
the context of a method of LogFile, exit() resolves to this->exit(), i.e.
the current method. :: is required to specify the C exit() function.
3) Since we are using a C runtime, we should exit via it, not bypass it with
a direct API call.
4) Even if we have been_here, we can still exit with the provided exit code.
OK to apply?
Max.