From: Jacob Bachmeyer Date: Sat, 5 Nov 2022 21:14:16 +0000 (-0500) Subject: Use structured exceptions in execute_commands X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=f9997b5dece4e8d819c83c93c3d1f5f01e367a06;p=gatekeeper.git Use structured exceptions in execute_commands --- diff --git a/gatekeeper.pl b/gatekeeper.pl index 9f453f4..5f54ca2 100755 --- a/gatekeeper.pl +++ b/gatekeeper.pl @@ -2491,21 +2491,25 @@ sub execute_commands { # if the symlink already exists, remove it if (-l $abslinkname) { unlink $abslinkname - or fatal("removal of symlink $linkname failed: $!",1); + or throw processing_error => command => $step, + summary => "removal of symlink $linkname failed: $!"; } # symlink away! symlink $target, $abslinkname - or fatal("creation of symlink $linkname " - ."to $target in $header->{directory} failed: $!",1); + or throw processing_error => command => $step, + summary => "creation of symlink $linkname " + ."to $target in $header->{directory} failed: $!"; ftp_syslog('info', "added symlink $linkname pointing to " ."$target in $header->{directory}"); } elsif ($step->[0] eq 'rmsymlink') { my $abslinkname = File::Spec->catfile($Public_dir, @directory, $step->[1]); - fatal("refusing to remove a non-symlink file",1) - unless -l $abslinkname; + throw processing_error => command => $step, + summary => "refusing to remove a non-symlink file" + unless -l $abslinkname; unlink $abslinkname - or fatal("removal of symlink $step->[1] failed: $!",1); + or throw processing_error => command => $step, + summary => "removal of symlink $step->[1] failed: $!"; ftp_syslog('info', "removed symlink $step->[1] in $header->{directory}"); } elsif ($step->[0] eq 'archive') { # We now also allow archiving entire directories