Subject: Re: ascii transfer size doesn't equal ls -l size

From: Ron Stanonik <[email-masked]>
Date: Fri, 20 Nov 1998 13:57:25 00800

Apples and Oranges
  The ls -l size if the binary size.  ASCII transfer converts LF to CR/LF on
  send and CR/LF to LF in receive.  Basically, the difference will be, in
  characters, the number of lines in the file (approximately).

Yes, there is a conversion between CR/LF and LF, but the code almost
gets the incoming filesize correct.  The problem was the case of \r
followed by something other than \n.  byte_count should have been
incremented.  The following corrected the problem, so that the filesize
in xferlog for incoming ascii files now matches the ls -l size.

rcsdiff -c ftpd.c
===================================================================
RCS file: RCS/ftpd.c,v
retrieving revision 1.4
diff -c -r1.4 ftpd.c
*** /tmp/T00ZbtuW       Fri Nov 20 13:49:27 1998
--- ftpd.c      Fri Nov 20 12:40:47 1998
***************
*** 2730,2735 ****
--- 2730,2736 ----
                      (void) putc('\r', outstr);
                      if (c == EOF) /* null byte fix, [email-masked] */
                          goto contin2;
+                   byte_count++;
                  }
              }
              (void) putc(c, outstr);