提交 b31b67cc 编写于 作者: K kohsuke

also do chmod(2) in an attempt to make a file writable.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@30734 71c3de6d-444a-0410-be80-ed276b4c234a
上级 9e6c227e
......@@ -41,6 +41,8 @@ import org.apache.tools.ant.taskdefs.Chmod;
import org.apache.tools.ant.taskdefs.Copy;
import org.apache.commons.lang.time.FastDateFormat;
import org.apache.commons.io.IOUtils;
import org.jruby.ext.posix.FileStat;
import org.jruby.ext.posix.POSIX;
import org.kohsuke.stapler.Stapler;
import org.jvnet.animal_sniffer.IgnoreJRERequirement;
......@@ -263,7 +265,7 @@ public class Util {
}
/**
* Makes the given file writable.
* Makes the given file writable by any means possible.
*/
@IgnoreJRERequirement
private static void makeWritable(File f) {
......@@ -284,6 +286,16 @@ public class Util {
} catch (NoSuchMethodError e) {
// not JDK6
}
try {// try libc chmod
POSIX posix = PosixAPI.get();
String path = f.getAbsolutePath();
FileStat stat = posix.stat(path);
posix.chmod(path, stat.mode()|0200); // u+w
} catch (Throwable t) {
LOGGER.log(Level.FINE,"Failed to chmod(2) "+f,t);
}
}
public static void deleteRecursive(File dir) throws IOException {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册