From 9290404ea7b135a1a0cc8d6518395e9a768087bf Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Mon, 17 Jan 2005 14:32:20 -0500 Subject: [PATCH] Applied patch from Francois Petillon (fantec at proxad.net) to avoid a file descriptor leak in the filefrag program. --- misc/ChangeLog | 5 +++++ misc/filefrag.c | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/misc/ChangeLog b/misc/ChangeLog index ea15bc9..214babf 100644 --- a/misc/ChangeLog +++ b/misc/ChangeLog @@ -1,3 +1,8 @@ +2005-01-17 Theodore Ts'o + + * filefrag.c (frag_report): Applied patch from Francois Petillon + (fantec at proxad.net) to avoid a file descriptor leak. + 2005-01-06 Theodore Ts'o * badblocks.c (alarm_intr): Increase the number of spaces reserved diff --git a/misc/filefrag.c b/misc/filefrag.c index e40941d..086e1ce 100644 --- a/misc/filefrag.c +++ b/misc/filefrag.c @@ -103,6 +103,7 @@ static void frag_report(const char *filename) } if (ioctl(fd, FIGETBSZ, &bs) < 0) { perror("FIGETBSZ"); + close(fd); return; } if (verbose) @@ -141,7 +142,7 @@ static void frag_report(const char *filename) (expected>1) ? "s" : ""); else fputc('\n', stdout); - + close(fd); } static void usage(const char *progname) -- 1.8.3.1