Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Mar 2001 01:41:10 +0100
From:      Ian Dowse <iedowse@maths.tcd.ie>
To:        "Andrey A. Chernov" <ache@FreeBSD.org>
Cc:        cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org, iedowse@maths.tcd.ie
Subject:   Re: cvs commit: src/usr.bin/tail forward.c 
Message-ID:   <200103280141.aa56792@salmon.maths.tcd.ie>
In-Reply-To: Your message of "Tue, 27 Mar 2001 15:24:26 -0800." <200103272324.f2RNOQc56458@freefall.freebsd.org> 

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi? <200103280141.aa56792>