From: Jacob Bachmeyer Date: Sun, 16 Oct 2022 02:39:40 +0000 (-0500) Subject: Rename ftp_die to ftp_abort in gatekeeper X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=e16c8694bd78d8762ea5494c5a601a12554b36d8;p=gatekeeper.git Rename ftp_die to ftp_abort in gatekeeper --- diff --git a/gatekeeper.pl b/gatekeeper.pl index 754c342..7fba45d 100755 --- a/gatekeeper.pl +++ b/gatekeeper.pl @@ -421,7 +421,7 @@ sub ftp_warn($) { warn $_[0]; } -sub ftp_die($;$) { +sub ftp_abort($;$) { my $msg = shift; my $exitcode = shift; $exitcode ||= 1; @@ -479,7 +479,8 @@ use constant MAX_DIRECTORY_DEPTH => 4; # Use die instead of fatal - this error should "never" happen. for my $dir ($package_config_base, $incoming_dir, $incoming_tmp, $destfinal, $desttmp) { - -d $dir or ftp_die("FATAL: configuration problem, $dir is not a directory"); + ftp_abort("FATAL: configuration problem, $dir is not a directory") + unless -d $dir; } @@ -648,7 +649,7 @@ sub mail { } else { $smtp = Net::SMTP->new ("127.0.0.1"); } - ftp_die("FATAL: SMTP connection failed") unless $smtp; + ftp_abort("FATAL: SMTP connection failed") unless $smtp; $smtp->mail($sender); $smtp->bcc($email_always) if ($send_to_user); @@ -701,7 +702,7 @@ sub debug { } else { $smtp = Net::SMTP->new ("127.0.0.1"); } - ftp_die("FATAL: SMTP connection failed") unless $smtp; + ftp_abort("FATAL: SMTP connection failed") unless $smtp; $smtp->mail ("ftp-upload-script\@gnu.org"); $smtp->recipient ($maintainer_email, { SkipBad => 1}); @@ -761,9 +762,9 @@ sub fatal { } close (PWD) or ftp_warn("pwd exited $?"); } else { # child - exec ("/bin/pwd") or ftp_die("can't exec pwd: $!"); + exec ("/bin/pwd") or ftp_abort("can't exec pwd: $!"); } - ftp_die("(in $cwd) $msg",$exit_code); + ftp_abort("(in $cwd) $msg",$exit_code); } @@ -877,7 +878,7 @@ sub scan_incoming { # Get list of all possible files from incoming dir. # opendir INCOMING, $directory - or ftp_die("FATAL opendir($directory) failed: $!"); + or ftp_abort("FATAL opendir($directory) failed: $!"); ENT: while (defined($_ = readdir INCOMING)) { next ENT if m/^[.]{1,2}$/; # skip . and .. entries # require acceptable filenames @@ -925,7 +926,7 @@ sub scan_incoming { $possible{$ent} = 1; } closedir INCOMING - or ftp_die("FATAL: closedir($directory) failed: $!"); + or ftp_abort("FATAL: closedir($directory) failed: $!"); # dispose of any garbage files ftp_syslog('info', "$badname_count files with bogus names were trashcanned") @@ -960,7 +961,7 @@ sub scan_incoming { if DEBUG; open LSOF, '-|', @lsof_args - or ftp_die("FATAL: cannot spawn lsof: $!");; + or ftp_abort("FATAL: cannot spawn lsof: $!");; while () { ftp_syslog('debug', "DEBUG: lsof output: $_") if DEBUG; # only look at the name lines @@ -1221,7 +1222,7 @@ sub read_directive_file { # Directory: dirname[/subdirname] # open (DIRECTIVE_FILE, "<", $directive_file) - or ftp_die("FATAL: open($directive_file) failed: $!"); + or ftp_abort("FATAL: open($directive_file) failed: $!"); my $cnt = 0; # Keep track of the order of directives... while () { my $line = $_; @@ -1854,7 +1855,7 @@ sub success_directive { sub cleanup_dir { my $dir = shift; opendir(DIR, $dir) - or ftp_die("Can’t opendir $dir in cleanup_dir: $!"); + or ftp_abort("Can’t opendir $dir in cleanup_dir: $!"); my @files = grep { ! /^\./ && -f "$dir/$_" } readdir(DIR); closedir DIR; @@ -1920,7 +1921,7 @@ foreach my $cell (@incoming) { # we've moved the files to work on to a new directory. chdir ($incoming_tmp) - or ftp_die("FATAL: chdir($incoming_tmp) failed: $!"); + or ftp_abort("FATAL: chdir($incoming_tmp) failed: $!"); for my $files (@incoming) { # each list element is a hash reference. ftp_syslog('info',"found directive: $files->{directive}\n");