All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ubi-utils: Fix file descriptor leaks in libubi
@ 2014-03-29 23:52 Daniel van Gerpen
  2014-03-31  9:53 ` Artem Bityutskiy
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel van Gerpen @ 2014-03-29 23:52 UTC (permalink / raw)
  To: linux-mtd


Signed-off-by: Daniel van Gerpen <daniel@vangerpen.de>
---
 ubi-utils/libubi.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/ubi-utils/libubi.c b/ubi-utils/libubi.c
index 598191e..c2d67af 100644
--- a/ubi-utils/libubi.c
+++ b/ubi-utils/libubi.c
@@ -419,6 +419,11 @@ static int vol_node2nums(struct libubi *lib, const char *node, int *dev_num,
 		errno = ENODEV;
 		return -1;
 	}
+	
+	if (close(fd)) {
+		sys_errmsg("close failed on \"%s\"", file);
+		return -1;
+	}
 
 	*dev_num = i;
 	*vol_id = minor - 1;
@@ -910,6 +915,11 @@ int ubi_probe_node(libubi_t desc, const char *node)
 	fd = open(file, O_RDONLY);
 	if (fd == -1)
 		goto out_not_ubi;
+	
+        if (close(fd)) {
+		sys_errmsg("close failed on \"%s\"", file);
+		return -1;
+	}
 
 	return 2;
 
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ubi-utils: Fix file descriptor leaks in libubi
  2014-03-29 23:52 [PATCH] ubi-utils: Fix file descriptor leaks in libubi Daniel van Gerpen
@ 2014-03-31  9:53 ` Artem Bityutskiy
  0 siblings, 0 replies; 2+ messages in thread
From: Artem Bityutskiy @ 2014-03-31  9:53 UTC (permalink / raw)
  To: Daniel van Gerpen; +Cc: linux-mtd

On Sun, 2014-03-30 at 00:52 +0100, Daniel van Gerpen wrote:
> Signed-off-by: Daniel van Gerpen <daniel@vangerpen.de>

Tweaked a bit and pushed to mtd-utils, thanks!

-- 
Best Regards,
Artem Bityutskiy

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-03-31  9:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-29 23:52 [PATCH] ubi-utils: Fix file descriptor leaks in libubi Daniel van Gerpen
2014-03-31  9:53 ` Artem Bityutskiy

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.