diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2010-07-02 11:50:51 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2010-07-02 11:50:51 +0000 |
commit | cc11bc67b069885b8c97d362c3c6db88399a56ef (patch) | |
tree | 31cfc61eeb2ca4e5af945bdd7fbd54d2e2fe14b9 /usr.sbin | |
parent | 6890173fa9689caa97c7d2cef0056a0321d4b6f4 (diff) |
use state to print error messages
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackageRepository/SCP.pm | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageRepository/SCP.pm b/usr.sbin/pkg_add/OpenBSD/PackageRepository/SCP.pm index 4fcd8924a92..c0de7177b8b 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackageRepository/SCP.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackageRepository/SCP.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: SCP.pm,v 1.23 2010/06/30 10:51:04 espie Exp $ +# $OpenBSD: SCP.pm,v 1.24 2010/07/02 11:50:50 espie Exp $ # # Copyright (c) 2003-2006 Marc Espie <espie@openbsd.org> # @@ -82,7 +82,7 @@ sub grab_object $_ = <$getfh>; chomp; if (m/^ERROR:/o) { - die "transfer error: $_"; + $self->{state}->fatal("transfer error: #1", $_); } if (m/^TRANSFER:\s+(\d+)/o) { my $buffsize = 10 * 1024; @@ -95,7 +95,7 @@ sub grab_object $n = read($getfh, $buffer, $remaining < $buffsize ? $remaining :$buffsize); if (!defined $n) { - die "Error reading\n"; + $self->{state}->fatal("Error reading: #1", $!); } $remaining -= $n; if ($n > 0) { @@ -136,14 +136,14 @@ sub list my $_; $_ = <$getfh>; if (!defined $_) { - die "Could not initiate SSH session\n"; + $self->{state}->fatal("Could not initiate SSH session"); } chomp; if (m/^ERROR:/o) { - die $_; + $self->{state}->fatal("#1", $_); } if (!m/^SUCCESS:/o) { - die "Synchronization error\n"; + $self->{state}->fatal("Synchronization error"); } while (<$getfh>) { chomp; |