Browse Source

reset internal state in <chmod> (bug 7552 audit).

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@272345 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 23 years ago
parent
commit
85875db138
1 changed files with 9 additions and 3 deletions
  1. +9
    -3
      src/main/org/apache/tools/ant/taskdefs/Chmod.java

+ 9
- 3
src/main/org/apache/tools/ant/taskdefs/Chmod.java View File

@@ -172,13 +172,19 @@ public class Chmod extends ExecuteOn {


public void execute() throws BuildException { public void execute() throws BuildException {
if (defaultSetDefined || defaultSet.getDir(project) == null) { if (defaultSetDefined || defaultSet.getDir(project) == null) {
super.execute();
try {
super.execute();
} finally {
filesets.removeElement(defaultSet);
}
} else if (isValidOs()) { } else if (isValidOs()) {
// we are chmodding the given directory // we are chmodding the given directory
createArg().setValue(defaultSet.getDir(project).getPath());
Execute execute = prepareExec(); Execute execute = prepareExec();
Commandline cloned = (Commandline) cmdl.clone();
cloned.createArgument().setValue(defaultSet.getDir(project)
.getPath());
try { try {
execute.setCommandline(cmdl.getCommandline());
execute.setCommandline(cloned.getCommandline());
runExecute(execute); runExecute(execute);
} catch (IOException e) { } catch (IOException e) {
throw new BuildException("Execute failed: " + e, e, location); throw new BuildException("Execute failed: " + e, e, location);


Loading…
Cancel
Save