Skip to content
Snippets Groups Projects
Commit 114d3421 authored by Guillaume ROUSSE's avatar Guillaume ROUSSE
Browse files

use local filehandle

parent 763fb58f
No related branches found
No related tags found
No related merge requests found
......@@ -365,11 +365,11 @@ sub req_generate_token {
my $sender = $self->{configuration}->{notice_from};
my $recipient = $self->{in}->{email_address};
unless (open(SENDMAIL, "|/usr/sbin/sendmail -f $sender $recipient")) {
open(my $handle, '|-', "/usr/sbin/sendmail -f $sender $recipient") or do {
push @{ $self->{out}->{errors} }, "mail_notification_error";
$self->{logger}->errorf("Mail notification error: %s", $ERRNO);
$self->{logger}->errorf("Unable to run sendmail executable: %s", $ERRNO);
return undef;
}
};
my $tt2 = Template->new({
INCLUDE_PATH => $self->{configuration}->{templates_dir}
......@@ -391,13 +391,13 @@ sub req_generate_token {
authentication_token => $token->token(),
};
unless ($tt2->process($template, $data, \*SENDMAIL)) {
unless ($tt2->process($template, $data, $handle)) {
push @{ $self->{out}->{errors} }, "mail_notification_error";
$self->{logger}->errorf("Mail notification error: %s", $EVAL_ERROR);
return undef;
}
close SENDMAIL;
close $handle;
$self->{logger}->infof(
"Token send to %s for sp_entityid=%s;token=%s",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment