diff options
author | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 1999-09-23 18:50:59 +0000 |
---|---|---|
committer | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 1999-09-23 18:50:59 +0000 |
commit | 86cd54aa0042056186bf1c2470038bb0ec6eb0f4 (patch) | |
tree | a7bf4c3c72c80e372c2cadf7180155d043dc9684 /libjava/prims.cc | |
parent | 69fb1563aed5d7a2606052e233516aab51ef04d1 (diff) | |
download | gcc-86cd54aa0042056186bf1c2470038bb0ec6eb0f4.tar.gz |
* prims.cc (main_init): New function.
(JvRunMain): Call it.
(_Jv_RunMain): Likewise.
Include <signal.h>.
(main_init): Ignore SIGPIPE. Fixes PR 51.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@29625 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/prims.cc')
-rw-r--r-- | libjava/prims.cc | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/libjava/prims.cc b/libjava/prims.cc index 39d8d763d76..39357a24d85 100644 --- a/libjava/prims.cc +++ b/libjava/prims.cc @@ -14,6 +14,7 @@ details. */ #include <stdarg.h> #include <stdio.h> #include <string.h> +#include <signal.h> #pragma implementation "gcj/array.h" @@ -595,8 +596,8 @@ static java::lang::ThreadGroup *main_group; // 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 @@ JvRunMain (jclass klass, int argc, const char **argv) 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 @@ JvRunMain (jclass klass, int argc, const char **argv) 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); |