提交 5a6445a4 编写于 作者: D dxu

4792059: test/java/io/pathNames/GeneralSolaris.java fails on symbolic links

Summary: Exclude the possible usage of linked files or directories in the test
Reviewed-by: alanb
上级 469ef1eb
......@@ -28,6 +28,7 @@
import java.io.*;
import java.util.*;
import java.nio.file.*;
public class General {
......@@ -57,7 +58,7 @@ public class General {
for (int i = 0; i < dl.length; i++) {
File f = new File(subdir, dl[i]);
File df = new File(dir, f.getPath());
if (df.exists() && df.isFile()) {
if (Files.isRegularFile(df.toPath(), LinkOption.NOFOLLOW_LINKS)) {
return f.getPath();
}
}
......@@ -65,7 +66,7 @@ public class General {
File f = (subdir.length() == 0) ? new File(dl[i])
: new File(subdir, dl[i]);
File df = new File(dir, f.getPath());
if (df.exists() && df.isDirectory()) {
if (Files.isDirectory(df.toPath(), LinkOption.NOFOLLOW_LINKS)) {
String[] dl2 = df.list();
if (dl2 != null) {
String ff = findSomeFile(dir, f.getPath(), dl2);
......@@ -90,7 +91,7 @@ public class General {
}
for (int i = 0; i < dl.length; i++) {
File f = new File(dir, dl[i]);
if (f.isFile()) {
if (Files.isRegularFile(f.toPath(), LinkOption.NOFOLLOW_LINKS)) {
return dl[i];
}
}
......@@ -127,7 +128,7 @@ public class General {
}
for (int i = 0; i < dl.length; i++) {
File f = new File(d, dl[i]);
if (f.isDirectory()) {
if (Files.isDirectory(f.toPath(), LinkOption.NOFOLLOW_LINKS)) {
String[] dl2 = f.list();
if (dl2 == null || dl2.length >= 250) {
/* Heuristic to avoid scanning huge directories */
......@@ -314,7 +315,7 @@ public class General {
/* Normal name */
if (f.exists()) {
if (f.isDirectory() && f.list() != null) {
if (Files.isDirectory(f.toPath(), LinkOption.NOFOLLOW_LINKS) && f.list() != null) {
if ((n = findSomeFile(ans, create)) != null)
checkSlashes(d, create, ans + n, ask + n);
if ((n = findSomeDir(ans, create)) != null)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册