From owner-cvs-all Tue Mar 27 16:41:19 2001 Delivered-To: cvs-all@freebsd.org Received: from salmon.maths.tcd.ie (salmon.maths.tcd.ie [134.226.81.11]) by hub.freebsd.org (Postfix) with SMTP id 022A737B71A; Tue, 27 Mar 2001 16:41:12 -0800 (PST) (envelope-from iedowse@maths.tcd.ie) Received: from walton.maths.tcd.ie by salmon.maths.tcd.ie with SMTP id ; 28 Mar 2001 01:41:10 +0100 (BST) To: "Andrey A. Chernov" Cc: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org, iedowse@maths.tcd.ie Subject: Re: cvs commit: src/usr.bin/tail forward.c In-Reply-To: Your message of "Tue, 27 Mar 2001 15:24:26 -0800." <200103272324.f2RNOQc56458@freefall.freebsd.org> Date: Wed, 28 Mar 2001 01:41:10 +0100 From: Ian Dowse Message-ID: <200103280141.aa56792@salmon.maths.tcd.ie> Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In message <200103272324.f2RNOQc56458@freefall.freebsd.org>, "Andrey A. Chernov " writes: >tatus: O > Log: > Restore part of my fix spammed in v1.23: > fseeko(file_size, SEEK_SET) -> fseek(0L, SEEK_END) > 1) File may grows between operations, so fseeko to file_size may miss > 2) 0L, SEEK_END is the same code using in tail in all other places Actually, I think the "fseeko(fp, sbp->st_size, SEEK_SET)" may be more correct here. This line used to be (before rev 1.19) fseek(fp, (long)sbp->st_size, SEEK_SET) and the comment beside it says: /* Set the file pointer to reflect the length displayed. */ so the idea is that we want to move the file pointer to guarantee that it is just after the last character displayed. This avoids the possibility of losing data when arguments such as tail -f -n 10 filename are used and the file grows while the 10 lines are being printed. Ian To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message