diff options
author | Alfred M. Szmidt <ams@gnu.org> | 2007-08-04 21:50:01 +0000 |
---|---|---|
committer | Matthias Klose <doko@gcc.gnu.org> | 2007-08-04 21:50:01 +0000 |
commit | fcfdb14511b80144d1d78a53e9b69483fb99a36a (patch) | |
tree | a5afac585b0652d768e5750f87e604254164c8f6 /libjava/java | |
parent | cbef3aa2f67797b2f4a54b10c2e5ba23f216dd6f (diff) | |
download | gcc-fcfdb14511b80144d1d78a53e9b69483fb99a36a.tar.gz |
natFilePosix.cc (init_native): Define to 0.
2007-08-04 Alfred M. Szmidt <ams@gnu.org>
* java/io/natFilePosix.cc (init_native) [!MAXPATHLEN]: Define to 0.
* java/io/File.java (createTempFile): Don't truncate if the system
doesn't have a limit on the length of a file name.
* classpath/lib/java/io/File.class: Regenerate.
From-SVN: r127216
Diffstat (limited to 'libjava/java')
-rw-r--r-- | libjava/java/io/File.java | 5 | ||||
-rw-r--r-- | libjava/java/io/natFilePosix.cc | 6 |
2 files changed, 10 insertions, 1 deletions
diff --git a/libjava/java/io/File.java b/libjava/java/io/File.java index 67d1b96df6c..0c4fb6932f5 100644 --- a/libjava/java/io/File.java +++ b/libjava/java/io/File.java @@ -117,6 +117,7 @@ public class File implements Serializable, Comparable<File> public static final char pathSeparatorChar = pathSeparator.charAt(0); static final String tmpdir = System.getProperty("java.io.tmpdir"); + /* If 0, then the system doesn't have a file name length limit. */ static int maxPathLen; static boolean caseSensitive; @@ -1130,7 +1131,9 @@ public class File implements Serializable, Comparable<File> // Truncation rules. // `6' is the number of characters we generate. - if (prefix.length() + 6 + suffix.length() > maxPathLen) + // If maxPathLen equals zero, then the system doesn't have a limit + // on the file name, so there is nothing to truncate. + if (maxPathLen > 0 && prefix.length() + 6 + suffix.length() > maxPathLen) { int suf_len = 0; if (suffix.charAt(0) == '.') diff --git a/libjava/java/io/natFilePosix.cc b/libjava/java/io/natFilePosix.cc index d63625f57a5..ead28557f6e 100644 --- a/libjava/java/io/natFilePosix.cc +++ b/libjava/java/io/natFilePosix.cc @@ -504,6 +504,12 @@ java::io::File::performDelete (void) void java::io::File::init_native () { +#ifdef MAXPATHLEN maxPathLen = MAXPATHLEN; +#else + /* Some systems do not have a limit on the length of a file name, + the GNU system is one such example. */ + maxPathLen = 0; +#endif caseSensitive = true; } |