}
}
};
-
+ ftp_warn ("eval failed: $@") if $@;
+
# clean up files if we abort while processing a triplet
cleanup ($files->{"sig"}, $files->{"upload"}, $files->{"directive"}) if ($@);
# clear out the current package that we just finished processing
chomp($cwd);
# change to destination dir
chdir($destdir);
+ # if the symlink already exists, remove it
+ if (-l $info{$key}{link}) {
+ unlink($info{$key}{link}) || &fatal("removal of symlink $info{$key}{link} failed: $!",1);
+ }
# symlink away!
- symlink("$target",$info{$key}{link}) || &fatal("creation of symlink $info{$key}{link} to $1 in $destdir failed: $!",1);
+ symlink("$target",$info{$key}{link}) || &fatal("creation of symlink $info{$key}{link} to $target in $destdir failed: $!",1);
# go back to current working dir
- ftp_syslog('info', "($log_style) added symlink $destdir/" . $info{$key}{link} . " pointing to $destdir/$1");
+ ftp_syslog('info', "($log_style) added symlink $destdir/" . $info{$key}{link} . " pointing to $destdir/$target");
chdir($cwd) || &fatal("chdir to $cwd failed: $!",1);
} elsif ($key =~ /^rmsymlink-(.*)/) {
+ &fatal("refusing to remove a non-symlink file",1) unless -l "$destdir/$1";
unlink("$destdir/$1") || &fatal("removal of symlink $1 failed: $!",1);
ftp_syslog('info', "($log_style) removed symlink $destdir/$1");
} elsif ($key =~ /^archive-(.*)/) {