for my $dir ($package_config_base, $Inbox_dir, $Scratch_dir,
$Public_dir, $Stage_dir, $archive_test_dir) {
- ftp_abort("FATAL: configuration problem, $dir is not a directory")
+ ftp_abort "FATAL: configuration problem, $dir is not a directory"
unless -d $dir;
}
# test moving a file from inbox to scratch
{
sysopen my $test, $infile, O_WRONLY|O_CREAT|O_EXCL
- or ftp_abort("FATAL: create test file in inbox: $!");
+ or ftp_abort "FATAL: create test file in inbox: $!";
close $test;
unless (rename $infile, $scratchfile and -f $scratchfile) {
unlink $infile;
- ftp_abort("FATAL: could not rename file from inbox to scratchpad: $!");
+ ftp_abort "FATAL: could not rename file from inbox to scratchpad: $!";
}
unlink $scratchfile; # test complete
}
# test moving a file from stage to public to archive
{
sysopen my $test, $stagefile, O_WRONLY|O_CREAT|O_EXCL
- or ftp_abort("FATAL: create test file in staging directory: $!");
+ or ftp_abort "FATAL: create test file in staging directory: $!";
close $test;
unless (rename $stagefile, $pubfile and -f $pubfile) {
unlink $stagefile;
- ftp_abort("FATAL: could not rename file from staging to public: $!");
+ ftp_abort "FATAL: could not rename file from staging to public: $!";
}
unless (rename $pubfile, $arcfile and -f $arcfile) {
unlink $pubfile;
- ftp_abort("FATAL: could not rename file from public to archive: $!");
+ ftp_abort "FATAL: could not rename file from public to archive: $!";
}
unlink $arcfile; # test complete
}
my $flags;
# - clear on status and log sinks
$flags = fcntl $gpgv_status_sink, F_GETFD, 0
- or ftp_abort("ERR: fcntl F_GETFD on status: $!");
+ or ftp_abort "ERR: fcntl F_GETFD on status: $!";
fcntl $gpgv_status_sink, F_SETFD, $flags & ~FD_CLOEXEC
- or ftp_abort("ERR: fcntl F_SETFD on status: $!");
+ or ftp_abort "ERR: fcntl F_SETFD on status: $!";
$flags = fcntl $gpgv_log_sink, F_GETFD, 0
- or ftp_abort("ERR: fcntl F_GETFD on log: $!");
+ or ftp_abort "ERR: fcntl F_GETFD on log: $!";
fcntl $gpgv_log_sink, F_SETFD, $flags & ~FD_CLOEXEC
- or ftp_abort("ERR: fcntl F_SETFD on log: $!");
+ or ftp_abort "ERR: fcntl F_SETFD on log: $!";
# - set on flag pipe sink
$flags = fcntl $gpgv_flag_sink, F_GETFD, 0
- or ftp_abort("ERR: fcntl F_GETFD on flag: $!");
+ or ftp_abort "ERR: fcntl F_GETFD on flag: $!";
fcntl $gpgv_flag_sink, F_SETFD, $flags | FD_CLOEXEC
- or ftp_abort("ERR: fcntl F_SETFD on flag: $!");
+ or ftp_abort "ERR: fcntl F_SETFD on flag: $!";
# Prepare STDIN/STDOUT/STDERR
- open STDIN, '<&', $gpgv_stdin or ftp_abort("ERR: set stdin: $!");
- open STDOUT, '>&', $gpgv_output_sink or ftp_abort("ERR: set stdout: $!");
- open STDERR, '>&', $gpgv_output_sink or ftp_abort("ERR: set stderr: $!");
+ open STDIN, '<&', $gpgv_stdin or ftp_abort "ERR: set stdin: $!";
+ open STDOUT, '>&', $gpgv_output_sink or ftp_abort "ERR: set stdout: $!";
+ open STDERR, '>&', $gpgv_output_sink or ftp_abort "ERR: set stderr: $!";
# Exec gpgv
- exec { GPGV_BIN } @gpgv_args or ftp_abort("ERR: exec: $!");
+ exec { GPGV_BIN } @gpgv_args or ftp_abort "ERR: exec: $!";
}
# The parent continues here...
foreach my $cell ([$gpgv_stdin_source, 'message'], [$gpgv_output, 'output'],
[$gpgv_log, 'log'], [$gpgv_status, 'status']) {
my $flags = fcntl $cell->[0], F_GETFL, 0
- or ftp_abort("gpgv: fcntl F_GETFL $cell->[1]: $!");
+ or ftp_abort "gpgv: fcntl F_GETFL $cell->[1]: $!";
fcntl $cell->[0], F_SETFL, $flags | O_NONBLOCK
- or ftp_abort("gpgv: fcntl F_SETFL $cell->[1]: $!");
+ or ftp_abort "gpgv: fcntl F_SETFL $cell->[1]: $!";
}
return $pid, $gpgv_stdin_source, $gpgv_output, $gpgv_log, $gpgv_status;
/gcx) {
# $1 -- pubkey algorithm $2 -- digest algorithm
# $3 -- timestamp $4 -- result code
- ftp_abort('gpgv returned an ISO8601 timestamp; implementation needed')
+ ftp_abort 'gpgv returned an ISO8601 timestamp; implementation needed'
if $3 =~ m/T/;
$ret->{sig_creation} = $3;
} else
# $11 -- primary key fingerprint
$ret->{key_fingerprint} = $2;
$ret->{key_longid} = substr $2,-16;
- ftp_abort('gpgv returned an ISO8601 timestamp; implementation needed')
+ ftp_abort 'gpgv returned an ISO8601 timestamp; implementation needed'
if $4 =~ m/T/ || $5 =~ m/T/;
$ret->{sig_creation} = $4;
# GPG reports 0 if the signature does not expire
($pid, $gpgv_stdin_source, $gpgv_output, $gpgv_log, $gpgv_status) =
_spawn_gpgv(\@keyrings, '-');
- local $SIG{PIPE} = sub { ftp_abort('gpgv exited unexpectedly') };
+ local $SIG{PIPE} = sub { ftp_abort 'gpgv exited unexpectedly' };
my $Rchk = ''; my $Wchk = '';
vec($Wchk, (fileno $gpgv_stdin_source), 1) = 1;
vec($Rchk, (fileno $_), 1) = 1 for ($gpgv_output, $gpgv_log, $gpgv_status);
} else {
$smtp = Net::SMTP->new(Host => 'localhost');
}
- ftp_abort("FATAL: SMTP connection failed") unless $smtp;
+ ftp_abort "FATAL: SMTP connection failed" unless $smtp;
$smtp->mail($sender);
$smtp->recipient(unique(@$recipients), { SkipBad => 1});
if DEBUG;
open LSOF, '-|', @lsof_args
- or ftp_abort("FATAL: cannot spawn lsof: $!");;
+ or ftp_abort "FATAL: cannot spawn lsof: $!";;
while (<LSOF>) {
ftp_syslog('debug', "DEBUG: lsof output: $_") if DEBUG;
# only look at the name lines
our $Scratch_dir; our $Public_dir;
- ftp_abort("invalid internal operation list")
+ ftp_abort "invalid internal operation list"
unless $oplist->[0][0] eq 'header';
my $header = $oplist->[0][1];
my @directory = File::Spec::Unix->splitdir($header->{directory});
} elsif (IN_TEST_MODE && $step->[0] eq 'no-op') {
# do nothing
} else {
- ftp_abort("unknown internal operation: $step->[0]");
+ ftp_abort "unknown internal operation: $step->[0]";
}
}
}
sub cleanup_dir {
my $dir = shift;
opendir(DIR, $dir)
- or ftp_abort("Can’t opendir $dir in cleanup_dir: $!");
+ or ftp_abort "Can’t opendir $dir in cleanup_dir: $!";
my @files = grep { !/^\./ && -f File::Spec->catfile($dir, $_) } readdir(DIR);
closedir DIR;