Subject: Why does ftp do this?
To: None <current-users@sun-lamp.cs.berkeley.edu>
From: John F. Woods <jfw@jfwhome.funhouse.com>
List: current-users
Date: 08/17/1994 08:28:47
I have discovered that ftp does something silly when sending files.  If it
gets an error writing to the data connection, it continues to read the local
file and (fruitlessly) writing to the data connection.  Is there any reason
for this?  It seems harmless (though I discovered it on an OSF/1-based system
where there's an apparent bug somewhere (in the compiler, I think) that is
causing ftp there to hang), but at any rate, here is a patch to change this:

*** ftp.c.orig  Wed Aug 17 08:26:39 1994
--- ftp.c       Wed Aug 17 08:22:07 1994
***************
*** 579,584 ****
--- 579,585 ----
                        for (bufp = buf; c > 0; c -= d, bufp += d)
                                if ((d = write(fileno(dout), bufp, c)) <= 0)
                                        break;
+                       if (d <= 0) break;
                        if (hash) {
                                while (bytes >= hashbytes) {
                                        (void) putchar('#');

This is in the TYPE_I send code; TYPE_A shares the problem, but before I  
wasted time coming up with a fix, I thought I'd ask if there's some actual
reason for this.
I send code; TYPE_A shares the problem, but before I  
wasted time coming up with a fix, I thought I'd ask if there's some actual
reason for this.

------------------------------------------------------------------------------