This is the mail archive of the cygwin-patches mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: abort() bug


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Christopher Faylor on 6/6/2008 11:54 AM:
|> Any reason that cygwin abort() closes all stdio streams prior to issuing
|> SIGABRT?
|>
|> In other words, I think that signal.cc needs to rearrange the
|> _GLOBAL_REENT->__cleanup to occur _after_ _my_tls.call_signal_handler.
|
| I think you're right.  The call to call_signal_handler was added years
| after the addition of the cleanup so it would make sense to move the
| cleanup handling after that.
|
| Want to submit a patch?

Sure.

2008-06-09 Eric Blake <ebb9@byu.net>

* signal.cc (abort): Only flush streams after signal handler.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             ebb9@byu.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkhNHggACgkQ84KuGfSFAYAIbQCglNJ0n46HGjTn1tcGqt7gEqbI
QgIAn08olZlxWhW9kaz+zjigM7PEcXpL
=xFlg
-----END PGP SIGNATURE-----
Index: signal.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/signal.cc,v
retrieving revision 1.87
diff -u -p -r1.87 signal.cc
--- signal.cc	7 Apr 2008 18:45:58 -0000	1.87
+++ signal.cc	9 Jun 2008 12:10:43 -0000
@@ -324,16 +324,6 @@ abort (void)
 {
   _my_tls.incyg++;
   sig_dispatch_pending ();
-  /* Flush all streams as per SUSv2.
-     From my reading of this document, this isn't strictly correct.
-     The streams are supposed to be flushed prior to exit.  However,
-     if there is I/O in any signal handler that will not necessarily
-     be flushed.
-     However this is the way FreeBSD does it, and it is much easier to
-     do things this way, so... */
-  if (_GLOBAL_REENT->__cleanup)
-    _GLOBAL_REENT->__cleanup (_GLOBAL_REENT);
-
   /* Ensure that SIGABRT can be caught regardless of blockage. */
   sigset_t sig_mask;
   sigfillset (&sig_mask);
@@ -342,6 +332,10 @@ abort (void)
 
   raise (SIGABRT);
   _my_tls.call_signal_handler (); /* Call any signal handler */
+
+  /* Flush all streams as per SUSv2.  */
+  if (_GLOBAL_REENT->__cleanup)
+    _GLOBAL_REENT->__cleanup (_GLOBAL_REENT);
   do_exit (SIGABRT);	/* signal handler didn't exit.  Goodbye. */
 }
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]