igt-dev.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t 1/1] runner: Plug an fd leak
@ 2018-09-27  9:30 Petri Latvala
  2018-09-27 10:22 ` Arkadiusz Hiler
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Petri Latvala @ 2018-09-27  9:30 UTC (permalink / raw)
  To: igt-dev

Make sure comparefd gets closed in dump_dmesg(). Otherwise we run out
of descriptors after a bit over 1000 tests executed...

Signed-off-by: Petri Latvala <petri.latvala@intel.com>
Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
---
 runner/executor.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/runner/executor.c b/runner/executor.c
index fd262eb4..d0539aa1 100644
--- a/runner/executor.c
+++ b/runner/executor.c
@@ -249,15 +249,19 @@ static void dump_dmesg(int kmsgfd, int outfd)
 		return;
 	lseek(comparefd, 0, SEEK_END);
 
-	if (fcntl(kmsgfd, F_SETFL, O_NONBLOCK))
+	if (fcntl(kmsgfd, F_SETFL, O_NONBLOCK)) {
+		close(comparefd);
 		return;
+	}
 
 	while (1) {
 		if (comparefd >= 0) {
 			r = read(comparefd, buf, sizeof(buf) - 1);
 			if (r < 0) {
-				if (errno != EAGAIN && errno != EPIPE)
+				if (errno != EAGAIN && errno != EPIPE) {
+					close(comparefd);
 					return;
+				}
 			} else {
 				buf[r] = '\0';
 				if (sscanf(buf, "%u,%llu,%llu,%c;",
@@ -278,6 +282,7 @@ static void dump_dmesg(int kmsgfd, int outfd)
 			 * If EAGAIN, we're done. If some other error,
 			 * we can't do anything anyway.
 			 */
+			close(comparefd);
 			return;
 		}
 
-- 
2.18.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

end of thread, other threads:[~2018-09-28  0:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-27  9:30 [igt-dev] [PATCH i-g-t 1/1] runner: Plug an fd leak Petri Latvala
2018-09-27 10:22 ` Arkadiusz Hiler
2018-09-27 14:43 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/1] " Patchwork
2018-09-28  0:01 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).