cluck($@) if $@;
}
-sub ftp_warn($) {
- ftp_syslog('warning', $_[0]);
- warn $_[0];
-}
-
{
# If this is set to a defined value, ftp_abort will write the message
# here instead of using syslog.
openlog(SYSLOG_APP_IDENT, 'pid', SYSLOG_FACILITY);
ftp_syslog('info', "Beginning upload processing run.");
+# send copies of warnings to syslog
+$SIG{__WARN__} = sub { ftp_syslog('warning', $_[0]); warn $_[0] };
+
#
# -- Filename validation patterns and limits
#
push @addresses, $1
if m/^([[:graph:]]+[@][[:graph:]]+)$/; # simple sanity check and untaint
}
- close EMAIL_FILE or ftp_warn("close($file) failed: $!");
+ close EMAIL_FILE or warn "close($file) failed: $!";
}
# Now also look for all maintainer addresses in the maintainers.bypkg file
pos = $nlen;
push @addresses, $1 while m/\G[^<]*<([^@]+[@][^>]+)>/g;
}
- close EMAIL_FILE or ftp_warn("close($maintainers_bypkg) failed: $!");
+ close EMAIL_FILE or warn "close($maintainers_bypkg) failed: $!";
return @addresses;
}
while (<PWD>) {
chomp ($cwd = $_);
}
- close (PWD) or ftp_warn("pwd exited $?");
+ close (PWD) or warn "pwd exited $?";
} else { # child
exec ("/bin/pwd") or ftp_abort("can't exec pwd: $!");
}
."upload in progress for $1, ignoring during this run")
if DEBUG;
delete ($possible{$1})
- or ftp_warn("WARNING: lsof found unrequested but open $1?!");
+ or warn "WARNING: lsof found unrequested but open $1?!";
}
close (LSOF);
mail ("upload of $upload_file and $sig_file complete",1);
unlink ($directive_file)
- or ftp_warn("unlink($directive_file) failed: $!");
+ or warn "unlink($directive_file) failed: $!";
}
sub success_directive {
my $directive_file = shift;
mail ("processing of $directive_file complete",1);
unlink ($directive_file)
- or ftp_warn("unlink($directive_file) failed: $!");
+ or warn "unlink($directive_file) failed: $!";
}
sub cleanup_dir {
};
unless ($complete) {
- ftp_warn ("eval failed: $@");
+ warn "eval failed: $@";
# clean up files if we abort while processing a triplet
cleanup ($sig_file, $upload_file, $directive_file)