2008-08-23 16:11:28

by Manish Katiyar

[permalink] [raw]
Subject: [PATCH] debugfs : Close the file handle and return in case of errors.

Close the filehandle and return in case if we are unable to expand the
directory during write.

Signed-off-by: "Manish Katiyar" <[email protected]>

---
debugfs/debugfs.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/debugfs/debugfs.c b/debugfs/debugfs.c
index 7039340..ab40de8 100644
--- a/debugfs/debugfs.c
+++ b/debugfs/debugfs.c
@@ -1366,6 +1366,7 @@ void do_write(int argc, char *argv[])
retval = ext2fs_expand_dir(current_fs, cwd);
if (retval) {
com_err(argv[0], retval, "while expanding directory");
+ close(fd);
return;
}
retval = ext2fs_link(current_fs, cwd, argv[2], newfile,
--
1.5.4.3


Thanks -
Manish


2008-08-24 03:15:53

by Theodore Ts'o

[permalink] [raw]
Subject: Re: [PATCH] debugfs : Close the file handle and return in case of errors.

On Sat, Aug 23, 2008 at 09:41:25PM +0530, Manish Katiyar wrote:
> Close the filehandle and return in case if we are unable to expand the
> directory during write.

Thanks, applied.

- Ted