From a6fc07845cf1c4e7456b10205d547b9171229c94 Mon Sep 17 00:00:00 2001 From: Jonathan Stowe Date: Wed, 9 Jan 2002 19:37:38 +0000 Subject: [PATCH] Re: [PATCH pp_sys.c] Fix segfault in dbmclose in DESTROY (was Re: [ID 20020104.007] coredump on dbmclose) Message-ID: p4raw-id: //depot/perl@14158 --- t/run/kill_perl.t | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/t/run/kill_perl.t b/t/run/kill_perl.t index e36be37..ca982d1 100644 --- a/t/run/kill_perl.t +++ b/t/run/kill_perl.t @@ -834,3 +834,36 @@ print "after: $$s\n"; EXPECT before: c after: c +######## [ID 20020104.007] "coredump on dbmclose" +package Foo; +eval { dbmclose %h }; # not all places have dbm* functions +if ($@) { + print "ok\n"; + exit 0; +} +package Foo; +sub new { + my $proto = shift; + my $class = ref($proto) || $proto; + my $self = {}; + bless($self,$class); + my %LT; + dbmopen(%LT, "dbmtest", 0666) || + die "Can't open dbmtest because of $!\n"; + $self->{'LT'} = \%LT; + return $self; +} +sub DESTROY { + my $self = shift; + dbmclose(%{$self->{'LT'}}); + return 1; +} +package main; +$test = Foo->new(); # must be package var +END +{ + 1 while unlink ; + print "ok\n"; +} +EXPECT +ok -- 2.7.4