2009-09-28 10:52:37

by Peng Tao

[permalink] [raw]
Subject: [PATCH] debugfs: add matching fclose

If the cmd_file is not stdin, we should close the file handle via fclose().
Thanks David Binderman to point this out.

Addresses-Novell-Bugzilla: #524526

Signed-off-by: Peng Tao <[email protected]>
---
debugfs/debugfs.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/debugfs/debugfs.c b/debugfs/debugfs.c
index 93227e3..7f75788 100644
--- a/debugfs/debugfs.c
+++ b/debugfs/debugfs.c
@@ -2133,6 +2133,8 @@ static int source_file(const char *cmd_file, int sci_idx)
exit_status++;
}
}
+ if (f != stdin)
+ fclose(f);
return exit_status;
}

--
1.6.5.rc2.262.g5224f



2009-10-04 02:31:35

by Theodore Ts'o

[permalink] [raw]
Subject: Re: [PATCH] debugfs: add matching fclose

On Mon, Sep 28, 2009 at 06:51:53PM +0800, Peng Tao wrote:
> If the cmd_file is not stdin, we should close the file handle via fclose().
> Thanks David Binderman to point this out.
>
> Addresses-Novell-Bugzilla: #524526
>
> Signed-off-by: Peng Tao <[email protected]>

Applied to the maint branch, thanks.

- Ted