summaryrefslogtreecommitdiff
path: root/usr/src/tools/codesign/signit.pl
diff options
context:
space:
mode:
authorjohnz <none@none>2007-05-04 21:05:20 -0700
committerjohnz <none@none>2007-05-04 21:05:20 -0700
commit2210853d176a7da9835ef47df74fd66c3c1a3e55 (patch)
tree2ad2525ecb575ce07c0964dfc741677a4ab97732 /usr/src/tools/codesign/signit.pl
parent740243730195c25d65f2a1987de1b96cc6783fde (diff)
downloadillumos-gate-2210853d176a7da9835ef47df74fd66c3c1a3e55.tar.gz
6550077 signproto/signit don't produce ERROR if ssh fails
Diffstat (limited to 'usr/src/tools/codesign/signit.pl')
-rw-r--r--usr/src/tools/codesign/signit.pl15
1 files changed, 13 insertions, 2 deletions
diff --git a/usr/src/tools/codesign/signit.pl b/usr/src/tools/codesign/signit.pl
index 1dd9ed9cb3..a3fe4f1fe7 100644
--- a/usr/src/tools/codesign/signit.pl
+++ b/usr/src/tools/codesign/signit.pl
@@ -81,6 +81,9 @@ $Outdir = $opt_o || $Indir; # default to input dir
$Indir = getcwd() . "/$Indir" if (substr($Indir, 0, 1) ne "/");
$Outdir = getcwd() . "/$Outdir" if (substr($Outdir, 0, 1) ne "/");
+# Ignore SIGPIPE to allow proper error messages
+$SIG{PIPE} = 'IGNORE';
+
# Create ssh connection to server
my(@args);
if (defined($opt_l)) {
@@ -88,7 +91,7 @@ if (defined($opt_l)) {
}
push @args, "-s", $Server, "codesign";
$pid = open2(*SRV_OUT, *SRV_IN, "/usr/bin/ssh", @args) or
- die "Can't start server\n";
+ die "ERROR Connection to server $Server failed\n";
select(SRV_IN); $| = 1; select(STDOUT); # unbuffered writes
# Sign each file with the specified credential
@@ -106,9 +109,17 @@ exit($Warnings > 0);
# Clean up after normal or abnormal exit.
#
sub END {
+ my $old_status = $?;
+
+ $? = 0;
close(SRV_IN);
close(SRV_OUT);
waitpid($pid, 0) if ($pid);
+ if ($?) {
+ print STDERR "ERROR Connection to server $Server failed\n";
+ $? = 1;
+ }
+ $? = $old_status if ($? == 0);
}
#
@@ -146,7 +157,7 @@ sub check_response {
exit(1);
}
else {
- print STDERR "Unrecognized response\n";
+ printf STDERR "ERROR Protocol failure (%d)\n", length($str);
exit(1);
}
}