1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-10-19 02:29:40 +00:00

tail -F: fix crash

PR:	280910

(cherry picked from commit 308399a179)
This commit is contained in:
Andre Albsmeier 2024-08-19 10:54:24 +03:00 committed by Konstantin Belousov
parent 2a1e8d7c30
commit cf4a34bbc7

View File

@ -382,7 +382,8 @@ follow(file_info_t *files, enum STYLE style, off_t off)
sb2.st_dev != file->st.st_dev ||
sb2.st_nlink == 0) {
show(file);
fclose(file->fp);
if (file->fp != NULL)
fclose(file->fp);
file->fp = ftmp;
memcpy(&file->st, &sb2,
sizeof(struct stat));