What about that?
Index: ftp.c
===================================================================
RCS file: /cvs/src/usr.bin/ftp/ftp.c,v
retrieving revision 1.83
diff -u -r1.83 ftp.c
--- ftp.c 13 Nov 2013 20:41:14 -0000 1.83
+++ ftp.c 29 Nov 2013 21:17:49 -0000
@@ -1089,9 +1089,10 @@
may_send_noop_char();
d = 0;
do {
- wr = write(fileno(fout), buf + d, rd);
- if (wr == -1 && errno == EPIPE)
+ if ((wr = write(fileno(fout), buf + d, rd)) ==
-1) {
+ d = -1;
break;
+ }
d += wr;
rd -= wr;
} while (d < c);
p is set to -1 to display the proper error message