summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjca <jca@openbsd.org>2013-12-20 13:44:51 +0000
committerjca <jca@openbsd.org>2013-12-20 13:44:51 +0000
commit2480c1db5c9bee88d32e8c6b0ce191396a400df9 (patch)
tree712a7598618ad6ad0f14e6ef985d237b50b54f43
parentBe less verbose when SNDIO_DEBUG=1 is set. (diff)
downloadwireguard-openbsd-2480c1db5c9bee88d32e8c6b0ce191396a400df9.tar.xz
wireguard-openbsd-2480c1db5c9bee88d32e8c6b0ce191396a400df9.zip
When writing a file, break out when we get a write(2) error, not
just EPIPE, else we'll just reattempt the write with non-sensical values. From Maxime Villard (max at m00nbsd dot net).
-rw-r--r--usr.bin/ftp/ftp.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.bin/ftp/ftp.c b/usr.bin/ftp/ftp.c
index 8bfb5ed3f40..0488f27c47d 100644
--- a/usr.bin/ftp/ftp.c
+++ b/usr.bin/ftp/ftp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ftp.c,v 1.83 2013/11/13 20:41:14 deraadt Exp $ */
+/* $OpenBSD: ftp.c,v 1.84 2013/12/20 13:44:51 jca Exp $ */
/* $NetBSD: ftp.c,v 1.27 1997/08/18 10:20:23 lukem Exp $ */
/*
@@ -1090,8 +1090,10 @@ recvrequest(const char *cmd, const char * volatile local, const char *remote,
d = 0;
do {
wr = write(fileno(fout), buf + d, rd);
- if (wr == -1 && errno == EPIPE)
+ if (wr == -1) {
+ d = -1;
break;
+ }
d += wr;
rd -= wr;
} while (d < c);