re PR libgcj/6652 (new java.io.File("").getCanonicalFile() throws exception)
* java/io/natFilePosix.cc (getCanonicalPath): Treat "" like ".". Fixes PR libgcj/6652. From-SVN: r54558
This commit is contained in:
parent
d65cb654ad
commit
6e32abbfc2
|
@ -1,3 +1,8 @@
|
||||||
|
2002-06-12 Tom Tromey <tromey@redhat.com>
|
||||||
|
|
||||||
|
* java/io/natFilePosix.cc (getCanonicalPath): Treat "" like ".".
|
||||||
|
Fixes PR libgcj/6652.
|
||||||
|
|
||||||
2002-06-10 Tom Tromey <tromey@redhat.com>
|
2002-06-10 Tom Tromey <tromey@redhat.com>
|
||||||
|
|
||||||
* java/lang/Class.h (Class::desiredAssertionStatus): Declare.
|
* java/lang/Class.h (Class::desiredAssertionStatus): Declare.
|
||||||
|
|
|
@ -104,9 +104,16 @@ java::io::File::attr (jint query)
|
||||||
jstring
|
jstring
|
||||||
java::io::File::getCanonicalPath (void)
|
java::io::File::getCanonicalPath (void)
|
||||||
{
|
{
|
||||||
char *buf = (char *) __builtin_alloca (JvGetStringUTFLength (path) + 1);
|
// We use `+2' here because we might need to use `.' for our special
|
||||||
|
// case.
|
||||||
|
char *buf = (char *) __builtin_alloca (JvGetStringUTFLength (path) + 2);
|
||||||
char buf2[MAXPATHLEN];
|
char buf2[MAXPATHLEN];
|
||||||
jsize total = JvGetStringUTFRegion (path, 0, path->length(), buf);
|
jsize total = JvGetStringUTFRegion (path, 0, path->length(), buf);
|
||||||
|
|
||||||
|
// Special case: treat "" the same as ".".
|
||||||
|
if (total == 0)
|
||||||
|
buf[total++] = '.';
|
||||||
|
|
||||||
buf[total] = '\0';
|
buf[total] = '\0';
|
||||||
|
|
||||||
#ifdef HAVE_REALPATH
|
#ifdef HAVE_REALPATH
|
||||||
|
|
Loading…
Reference in New Issue