summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2012-07-27 23:42:05 +0200
committerJim Meyering <meyering@redhat.com>2012-08-03 14:54:01 +0200
commite11a2cf3198bcec9a5e10205bf3ebe66dc7edc59 (patch)
tree68e541bd230bb8d180cc086f7d4e3cd9e8773747 /src
parent74a1c058753faa79caff061407925463375ba5f3 (diff)
downloadcoreutils-e11a2cf3198bcec9a5e10205bf3ebe66dc7edc59.tar.xz
tail: avoid rare error-path FD leak
* src/tail.c (tail_forever): Close FD to avoid leak after a failed fstat.
Diffstat (limited to 'src')
-rw-r--r--src/tail.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/tail.c b/src/tail.c
index 1935605ef..290ada483 100644
--- a/src/tail.c
+++ b/src/tail.c
@@ -1141,6 +1141,7 @@ tail_forever (struct File_spec *f, size_t n_files, double sleep_interval)
f[i].fd = -1;
f[i].errnum = errno;
error (0, errno, "%s", name);
+ close (fd); /* ignore failure */
continue;
}