make sure $hook is defined before printing it

This prevents error messages about $hook being undefined in the logs
This commit is contained in:
Matt Simerson 2012-04-22 16:55:17 -04:00 committed by Robert
parent 821b182081
commit 005c4d9105

View File

@ -130,7 +130,8 @@ sub varlog {
unless ( $rc and $rc == DECLINED or $rc == OK ) { unless ( $rc and $rc == DECLINED or $rc == OK ) {
# no logging plugins registered so fall back to STDERR # no logging plugins registered so fall back to STDERR
warn join(" ", $$ . warn join(" ", $$ .
(defined $plugin ? " $plugin plugin ($hook):" : (defined $plugin && defined $hook ? " $plugin plugin ($hook):" :
defined $plugin ? " $plugin plugin:" :
defined $hook ? " running plugin ($hook):" : ""), defined $hook ? " running plugin ($hook):" : ""),
@log), "\n" @log), "\n"
if $trace <= $TraceLevel; if $trace <= $TraceLevel;
@ -543,7 +544,7 @@ sub spool_dir {
my $self = shift; my $self = shift;
unless ( $Spool_dir ) { # first time through unless ( $Spool_dir ) { # first time through
$self->log(LOGINFO, "Initializing spool_dir"); $self->log(LOGDEBUG, "Initializing spool_dir");
$Spool_dir = $self->config('spool_dir') $Spool_dir = $self->config('spool_dir')
|| Qpsmtpd::Utils::tildeexp('~/tmp/'); || Qpsmtpd::Utils::tildeexp('~/tmp/');