]> gcc.gnu.org Git - gcc.git/commitdiff
re PR classpath/26990 (SecurityManager.checkExit() problem)
authorTom Tromey <tromey@redhat.com>
Tue, 4 Apr 2006 23:25:09 +0000 (23:25 +0000)
committerTom Tromey <tromey@gcc.gnu.org>
Tue, 4 Apr 2006 23:25:09 +0000 (23:25 +0000)
PR libgcj/26990:
* prims.cc (_Jv_RunMain): Use exitNoChecksAccessor.
* gnu/java/lang/natMainThread.cc (call_main): Use
exitNoChecksAccessor.
* testsuite/libjava.lang/pr26990.out: New file.
* testsuite/libjava.lang/pr26990.java: New file.
* java/lang/Runtime.java (exitNoChecks): New method.
(exitNoChecksAccessor): Likewise.
(exit): Call exitNoChecks.

From-SVN: r112685

libjava/ChangeLog
libjava/gnu/java/lang/natMainThread.cc
libjava/java/lang/Runtime.java
libjava/prims.cc
libjava/testsuite/libjava.lang/pr26990.java [new file with mode: 0644]
libjava/testsuite/libjava.lang/pr26990.out [new file with mode: 0644]

index ce599c13764617a65189d443d8c084e33bf4aaee..28b41f40ca1e5ca457d543a77a028c1c81e305e8 100644 (file)
@@ -1,3 +1,15 @@
+2006-04-04  Tom Tromey  <tromey@redhat.com>
+
+       PR libgcj/26990:
+       * prims.cc (_Jv_RunMain): Use exitNoChecksAccessor.
+       * gnu/java/lang/natMainThread.cc (call_main): Use
+       exitNoChecksAccessor.
+       * testsuite/libjava.lang/pr26990.out: New file.
+       * testsuite/libjava.lang/pr26990.java: New file.
+       * java/lang/Runtime.java (exitNoChecks): New method.
+       (exitNoChecksAccessor): Likewise.
+       (exit): Call exitNoChecks.
+
 2006-04-03  Tom Tromey  <tromey@redhat.com>
 
        * Makefile.in: Rebuilt.
index 95626eb3a71a40e422ba108d8dae8c7a241e5feb..99d5f95ffdeb6080f0d3e4906f0a7f450ea38ab0 100644 (file)
@@ -57,6 +57,5 @@ gnu::java::lang::MainThread::call_main (void)
   _Jv_ThreadWait ();
 
   int status = (int) ::java::lang::ThreadGroup::had_uncaught_exception;
-  ::java::lang::Runtime *runtime = ::java::lang::Runtime::getRuntime ();
-  runtime->exit (status);
+  ::java::lang::Runtime::exitNoChecksAccessor (status);
 }
index 519b4ac8c5ef7a081099441abf19706dbf5ab784..3466f19f2a00ca5bfc39d93c5d1ff874d9e999f8 100644 (file)
@@ -146,9 +146,20 @@ public class Runtime
     SecurityManager sm = SecurityManager.current; // Be thread-safe!
     if (sm != null)
       sm.checkExit(status);
+    exitNoChecks(status);
+  }
 
+  // Accessor to avoid adding a vtable slot.
+  static void exitNoChecksAccessor(int status)
+  {
+    current.exitNoChecks(status);
+  }
+
+  // Private since we can't add a vtable slot in 4.1.x.
+  private void exitNoChecks(int status)
+  {
     if (runShutdownHooks())
-      halt(status);
+      exitInternal(status);
 
     // Someone else already called runShutdownHooks().
     // Make sure we are not/no longer in the shutdownHooks set.
@@ -171,7 +182,7 @@ public class Runtime
     // while finalization for exit is going on and the status is non-zero
     // we halt immediately.
     if (status != 0)
-      halt(status);
+      exitInternal(status);
 
     while (true)
       try
index 1ef56742398da718eef86a3c5c8cde3990d8a7c3..5e016c94c7839deb0a22a1847b1586b927bd2e13 100644 (file)
@@ -1525,7 +1525,7 @@ _Jv_RunMain (JvVMInitArgs *vm_args, jclass klass, const char *name, int argc,
         ("Exception during runtime initialization"));
       t->printStackTrace();
       if (runtime)
-       runtime->exit (1);
+       java::lang::Runtime::exitNoChecksAccessor (1);
       // In case the runtime creation failed.
       ::exit (1);
     }
diff --git a/libjava/testsuite/libjava.lang/pr26990.java b/libjava/testsuite/libjava.lang/pr26990.java
new file mode 100644 (file)
index 0000000..88db93e
--- /dev/null
@@ -0,0 +1,13 @@
+public class pr26990
+{
+  public static void main (String args[]) throws Exception
+  {
+    System.setSecurityManager(new SecurityManager()
+                              {
+                                public void checkExit(int status)
+                                {
+                                  throw new SecurityException("This is a bug");
+                                }
+                              });
+  }
+}
diff --git a/libjava/testsuite/libjava.lang/pr26990.out b/libjava/testsuite/libjava.lang/pr26990.out
new file mode 100644 (file)
index 0000000..e69de29
This page took 0.089063 seconds and 5 git commands to generate.