From: unknown Date: Mon, 22 Feb 2010 14:59:52 +0000 (-0600) Subject: Import version as of 2010-02-22 for upload-ftp-v1.1.pl X-Git-Tag: 20200730__import~33 X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=127a89a059138463508d8c1d7d4cc8101f88f5d5;p=gatekeeper.git Import version as of 2010-02-22 for upload-ftp-v1.1.pl --- diff --git a/upload-ftp-v1.1.pl b/upload-ftp-v1.1.pl index 3360ddb..4bdca33 100755 --- a/upload-ftp-v1.1.pl +++ b/upload-ftp-v1.1.pl @@ -209,7 +209,8 @@ sub main } } }; - + 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 @@ -308,12 +309,17 @@ sub execute_commands { 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-(.*)/) {