diff options
author | Petri Latvala <petri.latvala@intel.com> | 2018-09-27 12:30:56 +0300 |
---|---|---|
committer | Petri Latvala <petri.latvala@intel.com> | 2018-09-28 11:50:53 +0300 |
commit | bdc8989328f57ec2e63a88c89a45440567c69eeb (patch) | |
tree | 199ff94e620d2c439cc366a22d81254483459518 /runner | |
parent | 6f5d6b06a90526b4a8de93398f3c2dd537b3b7ba (diff) |
runner: Plug an fd leak
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>
Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Diffstat (limited to 'runner')
-rw-r--r-- | runner/executor.c | 9 |
1 files 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; } |