diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2004-12-13 18:50:24 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2004-12-13 18:50:24 +0000 |
commit | 644a1ae3681165ac79756dd65624bb70e60bf816 (patch) | |
tree | e4c754960bad570820d12034fa723f5eda6ac9c0 /usr.sbin/pkg_add/OpenBSD | |
parent | 4fd01cfe3ba2dfe2817b2633739824fe00252189 (diff) |
fix test for syswrite errors: zero returns are legitimate.
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Ustar.pm | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Ustar.pm b/usr.sbin/pkg_add/OpenBSD/Ustar.pm index ab56ceef598..628e61bc97f 100644 --- a/usr.sbin/pkg_add/OpenBSD/Ustar.pm +++ b/usr.sbin/pkg_add/OpenBSD/Ustar.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Ustar.pm,v 1.13 2004/12/11 14:05:13 espie Exp $ +# $OpenBSD: Ustar.pm,v 1.14 2004/12/13 18:50:23 espie Exp $ # # Copyright (c) 2002-2004 Marc Espie <espie@openbsd.org> # @@ -223,20 +223,22 @@ START: if (defined $bs) { for (my $i = 0; $i + $bs <= length($buffer); $i+= $bs) { if (substr($buffer, $i, $bs) eq $zeroes) { - syswrite($fh, $buffer, $i) or return 0; + defined(syswrite($fh, $buffer, $i)) or return 0; $i+=$bs; my $seek_forward = $bs; while (substr($buffer, $i, $bs) eq $zeroes) { $i += $bs; $seek_forward += $bs; } - sysseek($fh, $seek_forward, 1) or return 0; + defined(sysseek($fh, $seek_forward, 1)) + or return 0; $buffer = substr($buffer, $i); goto START; } } } - syswrite($fh, $buffer) or return 0; + defined(syswrite($fh, $buffer)) or return 0; + return 1; } sub create |