TT#35426 get_fax(): fix fax data print into a closed filehandle

* in case of a specified fax format (pdf)
      the temp filehandle had been closed before filled in with data

Change-Id: I938cfa47051a525069902f73b83de121838c00bb
(cherry picked from commit 794b178dd1)
changes/78/20678/1
Kirill Solomko 7 years ago
parent 07395ed1d6
commit e778d3a931

@ -124,8 +124,8 @@ sub get_fax {
File::Temp::tempfile( DIR => $cfg->{spool_dir}."/tmp") File::Temp::tempfile( DIR => $cfg->{spool_dir}."/tmp")
or $self->error("Cannot create temp file: $ERRNO"); or $self->error("Cannot create temp file: $ERRNO");
binmode $tmp_fh; binmode $tmp_fh;
close $tmp_fh;
print $tmp_fh $item->voip_fax_data->data; print $tmp_fh $item->voip_fax_data->data;
close $tmp_fh;
} else { } else {
return ($item->voip_fax_data->data, $ext); return ($item->voip_fax_data->data, $ext);
} }

Loading…
Cancel
Save