natFileWin32.cc (isAbsolute): Check path length before looking at any characters.
2003-01-21 Vladimir Puskas <vpuskas@eunet.yu> * java/io/natFileWin32.cc (isAbsolute): Check path length before looking at any characters. * java/io/natFilePosix.cc (_stat): Only compute `buf' if it will be used. (isAbsolute): Check path's length as well. From-SVN: r61566
This commit is contained in:
parent
e8e8c1e5e3
commit
691255fb2a
@ -1,3 +1,11 @@
|
|||||||
|
2003-01-21 Vladimir Puskas <vpuskas@eunet.yu>
|
||||||
|
|
||||||
|
* java/io/natFileWin32.cc (isAbsolute): Check path length before
|
||||||
|
looking at any characters.
|
||||||
|
* java/io/natFilePosix.cc (_stat): Only compute `buf' if it will
|
||||||
|
be used.
|
||||||
|
(isAbsolute): Check path's length as well.
|
||||||
|
|
||||||
2003-01-17 Mark Wielaard <mark@klomp.org>
|
2003-01-17 Mark Wielaard <mark@klomp.org>
|
||||||
|
|
||||||
* Makefile.am (core_java_source_files): Add VMObjectStreamClass.java.
|
* Makefile.am (core_java_source_files): Add VMObjectStreamClass.java.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// natFile.cc - Native part of File class for POSIX.
|
// natFile.cc - Native part of File class for POSIX.
|
||||||
|
|
||||||
/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation
|
/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation
|
||||||
|
|
||||||
This file is part of libgcj.
|
This file is part of libgcj.
|
||||||
|
|
||||||
@ -60,14 +60,14 @@ java::io::File::_access (jint query)
|
|||||||
jboolean
|
jboolean
|
||||||
java::io::File::_stat (jint query)
|
java::io::File::_stat (jint query)
|
||||||
{
|
{
|
||||||
|
if (query == ISHIDDEN)
|
||||||
|
return getName()->charAt(0) == '.';
|
||||||
|
|
||||||
|
#ifdef HAVE_STAT
|
||||||
char *buf = (char *) __builtin_alloca (JvGetStringUTFLength (path) + 1);
|
char *buf = (char *) __builtin_alloca (JvGetStringUTFLength (path) + 1);
|
||||||
jsize total = JvGetStringUTFRegion (path, 0, path->length(), buf);
|
jsize total = JvGetStringUTFRegion (path, 0, path->length(), buf);
|
||||||
buf[total] = '\0';
|
buf[total] = '\0';
|
||||||
|
|
||||||
if (query == ISHIDDEN)
|
|
||||||
return (getName()->charAt(0) == '.');
|
|
||||||
|
|
||||||
#ifdef HAVE_STAT
|
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
if (::stat (buf, &sb))
|
if (::stat (buf, &sb))
|
||||||
return false;
|
return false;
|
||||||
@ -131,7 +131,7 @@ java::io::File::getCanonicalPath (void)
|
|||||||
jboolean
|
jboolean
|
||||||
java::io::File::isAbsolute (void)
|
java::io::File::isAbsolute (void)
|
||||||
{
|
{
|
||||||
return path->charAt(0) == '/';
|
return path->length() > 0 && path->charAt(0) == '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
jobjectArray
|
jobjectArray
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// natFileWin32.cc - Native part of File class.
|
// natFileWin32.cc - Native part of File class.
|
||||||
|
|
||||||
/* Copyright (C) 1998, 1999, 2002 Red Hat, Inc.
|
/* Copyright (C) 1998, 1999, 2002, 2003 Red Hat, Inc.
|
||||||
|
|
||||||
This file is part of libgcj.
|
This file is part of libgcj.
|
||||||
|
|
||||||
@ -119,7 +119,8 @@ java::io::File::getCanonicalPath (void)
|
|||||||
jboolean
|
jboolean
|
||||||
java::io::File::isAbsolute (void)
|
java::io::File::isAbsolute (void)
|
||||||
{
|
{
|
||||||
if (path->charAt(0) == '/' || path->charAt(0) == '\\')
|
if (path->length() > 0
|
||||||
|
&& (path->charAt(0) == '/' || path->charAt(0) == '\\'))
|
||||||
return true;
|
return true;
|
||||||
if (path->length() < 3)
|
if (path->length() < 3)
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user