diff options
author | Tom Tromey <tromey@redhat.com> | 2001-12-11 03:58:40 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2001-12-11 03:58:40 +0000 |
commit | d12a187337e82450144973ddd957287408318050 (patch) | |
tree | f6f9fdf56bc4450ecbd151f2eb704d7b11844a7e /libjava/java/lang/natClassLoader.cc | |
parent | 3afdfae81c8c771c6c949d2c2a93283a30b25a6f (diff) | |
download | gcc-d12a187337e82450144973ddd957287408318050.zip gcc-d12a187337e82450144973ddd957287408318050.tar.gz gcc-d12a187337e82450144973ddd957287408318050.tar.bz2 |
re PR libgcj/5064 (java/lang/natClassLoader.cc doesn't compile on systems without snprintf)
Fix for PR libgcj/5064.
* java/lang/natClassLoader.cc: Don't include stdio.h.
(_Jv_RegisterClassHookDefault): Don't use snprintf.
From-SVN: r47861
Diffstat (limited to 'libjava/java/lang/natClassLoader.cc')
-rw-r--r-- | libjava/java/lang/natClassLoader.cc | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libjava/java/lang/natClassLoader.cc b/libjava/java/lang/natClassLoader.cc index c9a5872..59aca07 100644 --- a/libjava/java/lang/natClassLoader.cc +++ b/libjava/java/lang/natClassLoader.cc @@ -14,7 +14,6 @@ details. */ #include <stdlib.h> #include <string.h> -#include <stdio.h> #include <gcj/cni.h> #include <jvm.h> @@ -463,9 +462,13 @@ _Jv_RegisterClassHookDefault (jclass klass) { // If you get this, it means you have the same class in two // different libraries. +#define TEXT "Duplicate class registration: " + // We size-limit MESSAGE so that you can't trash the stack. char message[200]; - snprintf (&message[0], 200, "Duplicate class registration: %s", - klass->name->data); + strcpy (message, TEXT); + strncpy (message + sizeof (TEXT) - 1, klass->name->data, + sizeof (message) - sizeof (TEXT)); + message[sizeof (message) - 1] = '\0'; if (! gcj::runtimeInitialized) JvFail (message); else |