bin/159750: [PATCH] /usr/bin/tail can call fclose(NULL) causing
core dump
Steve Wills
swills at FreeBSD.org
Sat Aug 13 22:50:08 UTC 2011
>Number: 159750
>Category: bin
>Synopsis: [PATCH] /usr/bin/tail can call fclose(NULL) causing core dump
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Sat Aug 13 22:50:07 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator: Steve Wills
>Release:
>Organization:
>Environment:
>Description:
I've been getting core dumps from tail when the FS it's on disappears. It can call fclose with a NULL argument, which causes the crash.
>How-To-Repeat:
run tail -F /path/to/file/on/md, then destroy the md(4)
>Fix:
See attached.
Patch attached with submission follows:
--- usr.bin/tail/forward.c.orig 2011-08-13 18:04:19.054770069 -0400
+++ usr.bin/tail/forward.c 2011-08-13 18:04:23.822771648 -0400
@@ -361,7 +361,9 @@
if (errno != ENOENT)
ierr(file->file_name);
show(file);
- fclose(file->fp);
+ if (file->fp != NULL) {
+ fclose(file->fp);
+ }
file->fp = NULL;
ev_change++;
continue;
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list