# HG changeset patch # User pesch # Date 1466517181 -7200 # Node ID 38ba582383f29d8efc8f7475ba385abc0a27e4ac # Parent 958202a7101b72a940985b8197476e7230e67578 changed $fd setting .. our does not work like expected.. diff -r 958202a7101b -r 38ba582383f2 lib/Nagios/Check/DNS/check_tlsa_record.pm --- a/lib/Nagios/Check/DNS/check_tlsa_record.pm Tue Jun 21 14:10:20 2016 +0200 +++ b/lib/Nagios/Check/DNS/check_tlsa_record.pm Tue Jun 21 15:53:01 2016 +0200 @@ -20,6 +20,7 @@ my $dane_pattern = '^(?(?\d+)\s+(?\d+)\s+(?\d+)\s+(?[0-9a-f ]+))$'; my $with_cname = '^(?[_a-z]+.*\n).*'; +#our ($handle, $tempfile) = tempfile( # didn't work like expected my ($handle, $tempfile) = tempfile( TEMPLATE => 'XXXXXXXXXXXXXXXX', DIR => '/tmp/', @@ -27,8 +28,10 @@ ); -my $fd = "/dev/fd/" . fileno $handle; +my $fd; my $flags = fcntl($handle, F_GETFD, 0); +$flags &= ~FD_CLOEXEC; +fcntl $handle, F_SETFD, $flags; sub main { my $domain = shift; @@ -78,10 +81,7 @@ my $cmd; my $cert; - #neede here because global doesn't work like expected - #but if set here filediscriptor is open for writing - $flags &= ~FD_CLOEXEC; - fcntl $handle, F_SETFD, $flags; + $fd = "/dev/fd/" . fileno $handle; if ($port == 25) { $cmd = "openssl s_client -starttls smtp -connect $domain:$port";