mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-09 18:16:10 +00:00
Fix up.
- If a write results in a file creation, do the create check, to align with the POSIX semantics. - Don't make pointless mkdirs check if the directory already exists - read vs readSymlink difference is dangerous because read() can be called for symlinks in other context as well.
This commit is contained in:
1 parent
e4a1ac2ba1
commit
7bd7e4f0b2
1 file changed
+8
-3
@@ -2563,13 +2563,13 @@ public final class FilePath implements Serializable {
|
||||
|
||||
@Override
|
||||
public void visitSymlink(File link, String target, String relativePath) throws IOException {
|
||||
filter.readSymlink(link);
|
||||
filter.read(link);
|
||||
v.visitSymlink(link, target, relativePath);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean understandsSymlink() {
|
||||
return true;
|
||||
return v.understandsSymlink();
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -2602,7 +2602,10 @@ public final class FilePath implements Serializable {
|
||||
* Pass through 'f' after ensuring that we can write to that file.
|
||||
*/
|
||||
private static File writing(File f) {
|
||||
FilePathFilter.currentNonnull().write(f);
|
||||
FilePathFilter filter = FilePathFilter.currentNonnull();
|
||||
if (!f.exists())
|
||||
filter.create(f);
|
||||
filter.write(f);
|
||||
return f;
|
||||
}
|
||||
|
||||
@@ -2616,6 +2619,8 @@ public final class FilePath implements Serializable {
|
||||
|
||||
|
||||
private static boolean mkdirs(File dir) {
|
||||
if (dir.exists()) return false;
|
||||
|
||||
FilePathFilter.currentNonnull().mkdirs(dir);
|
||||
return dir.mkdirs();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user