aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss Allbery <rra@stanford.edu>2007-10-04 22:06:46 +0000
committerRuss Allbery <rra@stanford.edu>2007-10-04 22:06:46 +0000
commit2f9387bdf0e047bbd193532c4fed209acabd0e7a (patch)
treeb037b3bdb6709257181dfb96f99a34d94c225d41
parent1f1038a03819cd9933daa3ab5e8e1f3a8a29394a (diff)
Fix error handling if we cannot dup stdout.
-rw-r--r--perl/Wallet/Object/Keytab.pm8
1 files changed, 5 insertions, 3 deletions
diff --git a/perl/Wallet/Object/Keytab.pm b/perl/Wallet/Object/Keytab.pm
index c78adc2..4ae7818 100644
--- a/perl/Wallet/Object/Keytab.pm
+++ b/perl/Wallet/Object/Keytab.pm
@@ -62,9 +62,11 @@ sub kadmin {
if (not defined $pid) {
die "cannot fork: $!\n";
} elsif ($pid == 0) {
- open (STDERR, '>&STDOUT') or die "cannot dup stdout: $!\n";
-
# Don't use die here; it will get trapped as an exception.
+ unless (open (STDERR, '>&STDOUT')) {
+ warn "wallet: cannot dup stdout: $!\n";
+ exit 1;
+ }
unless (exec ($Wallet::Config::KEYTAB_KADMIN, @args)) {
warn "wallet: cannot run $Wallet::Config::KEYTAB_KADMIN: $!\n";
exit 1;
@@ -73,7 +75,7 @@ sub kadmin {
local $_;
my @output;
while (<KADMIN>) {
- if (/^wallet: cannot run /) {
+ if (/^wallet: cannot /) {
s/^wallet: //;
die $_;
}