--- libjava/posix.cc.orig	2003-07-08 06:49:16.000000000 +0200
+++ libjava/posix.cc	2005-10-14 21:59:49.000000000 +0200
@@ -21,6 +21,9 @@
 #include <java/lang/Thread.h>
 #include <java/io/InterruptedIOException.h>
 #include <java/util/Properties.h>
+#include <java/lang/System.h>
+
+bool shutdownStarted = false;
 
 #if defined (ECOS)
 extern "C" unsigned long long _clock (void);
@@ -66,7 +69,19 @@
 #endif
 }
 
+static void
+shutdown (int signum)
+{
+  if(! shutdownStarted ){
+    shutdownStarted = true;
+    ::java::lang::System::exit (signum);
+    // this just calls ::java::lang::Runntime::exit (signum);
+  }
+}
+
 // Platform-specific VM initialization.
+// catch SIGINT|SIGHUP|SIGTERM and call exit()
+// see man 2 SIGACTION
 void
 _Jv_platform_initialize (void)
 {
@@ -77,8 +92,15 @@
   sigemptyset (&act.sa_mask);
   act.sa_flags = 0;
   sigaction (SIGPIPE, &act, NULL);
+  act.sa_handler = &shutdown;
+  sigaction (SIGHUP, &act, NULL);
+  sigaction (SIGINT, &act, NULL);
+  sigaction (SIGTERM, &act, NULL);
 #else
   signal (SIGPIPE, SIG_IGN);
+  signal (SIGHUP, &shutdown);
+  signal (SIGINT, &shutdown);
+  signal (SIGTERM, &shutdown);
 #endif
 
 #if defined (HAVE_PROC_SELF_EXE)
