From feb9f343f9e0b5e94132e878cdfeb2dc676aefb8 Mon Sep 17 00:00:00 2001 From: Russ Allbery Date: Sat, 1 Dec 2007 02:21:02 +0000 Subject: Don't close our open database handles after a failed fork. --- perl/Wallet/Object/Keytab.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'perl/Wallet/Object') diff --git a/perl/Wallet/Object/Keytab.pm b/perl/Wallet/Object/Keytab.pm index 025c9e1..6254d6f 100644 --- a/perl/Wallet/Object/Keytab.pm +++ b/perl/Wallet/Object/Keytab.pm @@ -62,13 +62,17 @@ sub kadmin { if (not defined $pid) { die "cannot fork: $!\n"; } elsif ($pid == 0) { - # Don't use die here; it will get trapped as an exception. + # Don't use die here; it will get trapped as an exception. Also be + # careful about our database handles. (We still lose if there's some + # other database handle open we don't know about.) unless (open (STDERR, '>&STDOUT')) { warn "wallet: cannot dup stdout: $!\n"; + $self->{dbh}->{InactiveDestroy} = 0 if ref $self; exit 1; } unless (exec ($Wallet::Config::KEYTAB_KADMIN, @args)) { warn "wallet: cannot run $Wallet::Config::KEYTAB_KADMIN: $!\n"; + $self->{dbh}->{InactiveDestroy} = 0 if ref $self; exit 1; } } -- cgit v1.2.3