From owner-freebsd-bugs Sun Mar 11 5:20: 5 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 2BB9437B719 for ; Sun, 11 Mar 2001 05:20:03 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f2BDK3p12323; Sun, 11 Mar 2001 05:20:03 -0800 (PST) (envelope-from gnats) Date: Sun, 11 Mar 2001 05:20:03 -0800 (PST) Message-Id: <200103111320.f2BDK3p12323@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Dag-Erling Smorgrav Subject: Re: bin/25699: ftpd doesn't count transfered data bytes Reply-To: Dag-Erling Smorgrav Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org The following reply was made to PR bin/25699; it has been noted by GNATS. From: Dag-Erling Smorgrav To: Yoshihiro Koya Cc: FreeBSD-gnats-submit@FreeBSD.ORG Subject: Re: bin/25699: ftpd doesn't count transfered data bytes Date: 11 Mar 2001 14:19:23 +0100 Yoshihiro Koya writes: > >Fix: > --- /usr/src/libexec/ftpd/ftpd.c.orig Sun Mar 11 20:19:53 2001 > +++ /usr/src/libexec/ftpd/ftpd.c Sun Mar 11 20:46:15 2001 > @@ -1756,10 +1756,12 @@ > if (!cnt) > goto oldway; > > + byte_count = offset; > goto data_err; > } > } > > + byte_count = offset; > reply(226, "Transfer complete."); > return; > } Wrong patch. You set byte_count to offset, so if the transfer was restarted in mid-file you also count bytes that *weren't* transferred. The correct fix is: Index: ftpd.c =================================================================== RCS file: /home/ncvs/src/libexec/ftpd/ftpd.c,v retrieving revision 1.72 diff -u -r1.72 ftpd.c --- ftpd.c 2000/12/20 03:34:54 1.72 +++ ftpd.c 2001/03/11 13:16:57 @@ -1749,6 +1749,7 @@ while (err != -1 && cnt < filesize) { err = sendfile(filefd, netfd, offset, len, (struct sf_hdtr *) NULL, &cnt, 0); + byte_count += cnt; offset += cnt; len -= cnt; (apply with 'patch -l' due to cut&paste corruption) DES -- Dag-Erling Smorgrav - des@ofug.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message