diff --git a/usr.bin/tail/forward.c b/usr.bin/tail/forward.c index a902e006afe..2edf8730e8b 100644 --- a/usr.bin/tail/forward.c +++ b/usr.bin/tail/forward.c @@ -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));