mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
tail: Fix crash if -F'ed file's filesystem disappears.
If tail notices that a file it is following no longer exists (because stat() fails), it will output any final lines and then close the file. If the read operation also causes an error, such as when the filesystem is forcefully unmounted, it closes the file as well, leading to fclose(NULL) and a segmentation fault. PR: bin/159750 Submitted by: swills Approved by: re (kib) MFC after: 1 week
This commit is contained in:
parent
a3427d6a49
commit
54d34ff63d
1 changed files with 4 additions and 2 deletions
|
|
@ -361,8 +361,10 @@ follow(file_info_t *files, enum STYLE style, off_t off)
|
|||
if (errno != ENOENT)
|
||||
ierr(file->file_name);
|
||||
show(file);
|
||||
fclose(file->fp);
|
||||
file->fp = NULL;
|
||||
if (file->fp != NULL) {
|
||||
fclose(file->fp);
|
||||
file->fp = NULL;
|
||||
}
|
||||
ev_change++;
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue