[prev in list] [next in list] [prev in thread] [next in thread]
List: coreutils-bug
Subject: [PATCH] tail -- close fd on a fstat failure
From: Giuseppe Scrivano <gscrivano () gnu ! org>
Date: 2009-05-30 19:52:09
Message-ID: 87ljoe5pxy.fsf () master ! homenet
[Download RAW message or body]
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 <gscrivano@gnu.org>
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
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic