Hi, I noticed that the fd is not closed properly if the fstat call fails. This trivial patch solves it.
Giuseppe >From 0f93ba2a0673a689bbeaf747b876f6f8c4bc6cae Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano <[email protected]> Date: Sat, 30 May 2009 21:41:26 +0200 Subject: [PATCH] tail: don't leave open fd when fstat fails. * src/tail.c (tail_forever): close the fd before overwrite it. --- src/tail.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/src/tail.c b/src/tail.c index fe34600..3ec896a 100644 --- a/src/tail.c +++ b/src/tail.c @@ -1033,6 +1033,7 @@ tail_forever (struct File_spec *f, int nfiles, double sleep_interval) { if (fstat (fd, &stats) != 0) { + close_fd (f[i].fd, pretty_name (f)); f[i].fd = -1; f[i].errnum = errno; error (0, errno, "%s", name); -- 1.6.3.1 _______________________________________________ Bug-coreutils mailing list [email protected] http://lists.gnu.org/mailman/listinfo/bug-coreutils
