]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
tail: fix the checks if the file was rotated
authoroshogbo <oshogbo@FreeBSD.org>
Sun, 9 Jun 2019 22:55:21 +0000 (22:55 +0000)
committeroshogbo <oshogbo@FreeBSD.org>
Sun, 9 Jun 2019 22:55:21 +0000 (22:55 +0000)
commitc93a14fd8c6e7afcc7861e5ad924c0047530e854
tree884c0cb918fc098ffb8dc3ae62fc63c325afd229
parente01b9b5db1283ab13232bbd5347209a75b17b2f6
tail: fix the checks if the file was rotated

The freopen(3) was replaced with fileargs_open(3) and fclose(3).
In the following function, we skip if the stream is standard in, so it is
safe to do so.
This also requires us to change the logic first to open the file and then
check its status. The stat(2) is disallowed in capability mode.

This commit unbrakes the -F option.
The bug was introduced in the r348708.

Reported by: pho
Tested by: pho
usr.bin/tail/extern.h
usr.bin/tail/forward.c
usr.bin/tail/misc.c
usr.bin/tail/read.c
usr.bin/tail/reverse.c
usr.bin/tail/tail.c