re PR libgcj/21821 (MAXPATHLEN usage in libjava)

2005-05-30  Bryce McKinlay  <mckinlay@redhat.com>

	PR libgcj/21821
	* gnu/java/nio/channels/natFileChannelPosix.cc (open): Don't use
	MAXPATHLEN. Format exception message using a StringBuffer instead.

From-SVN: r100364
This commit is contained in:
Bryce McKinlay 2005-05-30 16:02:38 +00:00 committed by Bryce McKinlay
parent 2a8a8f8fc2
commit 2a2ea37674
2 changed files with 12 additions and 5 deletions

View File

@ -1,3 +1,9 @@
2005-05-30 Bryce McKinlay <mckinlay@redhat.com>
PR libgcj/21821
* gnu/java/nio/channels/natFileChannelPosix.cc (open): Don't use
MAXPATHLEN. Format exception message using a StringBuffer instead.
2005-05-29 Michael Koch <konqueror@gmx.de>
PR libgcj/20273:

View File

@ -37,6 +37,7 @@ details. */
#include <java/lang/NullPointerException.h>
#include <java/lang/System.h>
#include <java/lang/String.h>
#include <java/lang/StringBuffer.h>
#include <java/lang/Thread.h>
#include <java/nio/ByteBuffer.h>
#include <java/nio/MappedByteBufferImpl.h>
@ -168,13 +169,13 @@ FileChannelImpl::open (jstring path, jint jflags)
}
if (fd == -1)
{
char msg[MAXPATHLEN + 200];
// We choose the formatting here for JDK compatibility, believe
// it or not.
sprintf (msg, "%.*s (%.*s)",
MAXPATHLEN + 150, buf,
40, strerror (errno));
throw new ::java::io::FileNotFoundException (JvNewStringLatin1 (msg));
::java::lang::StringBuffer *msg = new ::java::lang::StringBuffer (path);
msg->append (JvNewStringUTF (" ("));
msg->append (JvNewStringUTF (strerror (errno)));
msg->append (JvNewStringUTF (")"));
throw new ::java::io::FileNotFoundException (msg->toString ());
}
_Jv_platform_close_on_exec (fd);