diff options
author | Russ Allbery <rra@stanford.edu> | 2007-12-01 02:21:02 +0000 |
---|---|---|
committer | Russ Allbery <rra@stanford.edu> | 2007-12-01 02:21:02 +0000 |
commit | feb9f343f9e0b5e94132e878cdfeb2dc676aefb8 (patch) | |
tree | 2c775a91a9f569125f40abc721d1cc194bb4c5f4 /perl | |
parent | 89a9058f8aee85c11d975691b354d03f32c82747 (diff) |
Don't close our open database handles after a failed fork.
Diffstat (limited to 'perl')
-rw-r--r-- | perl/Wallet/Object/Keytab.pm | 6 |
1 files changed, 5 insertions, 1 deletions
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; } } |