xref: /openbsd-src/gnu/usr.bin/perl/cpan/Sys-Syslog/t/cpan-rt-64287.t (revision de8cc8edbc71bd3e3bc7fbffa27ba0e564c37d8b)
1#!perl
2use strict;
3use Test::More;
4
5plan tests => 4;
6
7# --------------------
8# CPAN-RT #64287: Avoid memory corruption when closelog() is called twice.
9#
10use Sys::Syslog;
11
12openlog("Sys::Syslog", "pid", "user");
13syslog(debug => "Lorem ipsum dolor sit amet");
14
15# first call to closelog()
16eval { closelog() };
17is($@, "", "closelog()");
18
19# create a variable with a reference to something
20$a = {};
21isa_ok($a, "HASH");
22
23# second call to closelog()
24eval { closelog() };
25is($@, "", "closelog()");
26
27# check that the variable still is what it's supposed to be
28isa_ok($a, "HASH");
29
30