This is the mail archive of the
java-patches@sourceware.cygnus.com
mailing list for the Java project.
Patch: PR 51 / ignore SIGPIPE
- To: Java Patch List <java-patches at sourceware dot cygnus dot com>
- Subject: Patch: PR 51 / ignore SIGPIPE
- From: Tom Tromey <tromey at cygnus dot com>
- Date: 23 Sep 1999 12:49:34 -0600
- Reply-To: tromey at cygnus dot com
I'm checking in the appended patch.
It fixes PR 51 by ignoring SIGPIPE.
1999-09-23 Tom Tromey <tromey@cygnus.com>
* prims.cc (main_init): New function.
(JvRunMain): Call it.
(_Jv_RunMain): Likewise.
Include <signal.h>.
(main_init): Ignore SIGPIPE. Fixes PR 51.
Tom
Index: prims.cc
===================================================================
RCS file: /cvs/java/libgcj/libjava/prims.cc,v
retrieving revision 1.9
diff -u -r1.9 prims.cc
--- prims.cc 1999/09/10 22:03:05 1.9
+++ prims.cc 1999/09/23 18:45:36
@@ -14,6 +14,7 @@
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
+#include <signal.h>
#pragma implementation "gcj/array.h"
@@ -595,8 +596,8 @@
// The primary thread.
static java::lang::Thread *main_thread;
-void
-JvRunMain (jclass klass, int argc, const char **argv)
+static void
+main_init (void)
{
INIT_SEGV;
#ifdef HANDLE_FPE
@@ -612,6 +613,19 @@
LTDL_SET_PRELOADED_SYMBOLS ();
#endif
+ // FIXME: we only want this on POSIX systems.
+ struct sigaction act;
+ act.sa_handler = SIG_IGN;
+ sigemptyset (&act.sa_mask);
+ act.sa_flags = 0;
+ sigaction (SIGPIPE, &act, NULL);
+}
+
+void
+JvRunMain (jclass klass, int argc, const char **argv)
+{
+ main_init ();
+
arg_vec = JvConvertArgv (argc - 1, argv + 1);
main_group = new java::lang::ThreadGroup (23);
main_thread = new java::lang::FirstThread (main_group, klass, arg_vec);
@@ -625,19 +639,7 @@
void
_Jv_RunMain (const char *class_name, int argc, const char **argv)
{
- INIT_SEGV;
-#ifdef HANDLE_FPE
- INIT_FPE;
-#else
- arithexception = new java::lang::ArithmeticException
- (JvNewStringLatin1 ("/ by zero"));
-#endif
-
- no_memory = new java::lang::OutOfMemoryError;
-
-#ifdef USE_LTDL
- LTDL_SET_PRELOADED_SYMBOLS ();
-#endif
+ main_init ();
arg_vec = JvConvertArgv (argc - 1, argv + 1);
main_group = new java::lang::ThreadGroup (23);