Use structured exceptions in execute_commands
authorJacob Bachmeyer <jcb@gnu.org>
Sat, 5 Nov 2022 21:14:16 +0000 (16:14 -0500)
committerJacob Bachmeyer <jcb@gnu.org>
Sat, 5 Nov 2022 21:14:16 +0000 (16:14 -0500)
gatekeeper.pl

index 9f453f4c7f4aeef50ecda7db8099db8e5ce5d40e..5f54ca2e22cf10aff684a631de23cb41f0429e22 100755 (executable)
@@ -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