From e3b19530e4a689f9f8e417ebf737dfca2340342b Mon Sep 17 00:00:00 2001 From: David Gibson Date: Tue, 23 May 2023 12:25:43 +1000 Subject: test/nstool: Fix fd leak in accept() loop nstool loops on accept(), but failed to close the accepted socket fds before continuing on. So, with repeated commands it would eventually die with an EMFILE. Signed-off-by: David Gibson Signed-off-by: Stefano Brivio --- test/nstool.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/nstool.c b/test/nstool.c index bca9569..1bdf44e 100644 --- a/test/nstool.c +++ b/test/nstool.c @@ -201,6 +201,8 @@ static void cmd_hold(int argc, char *argv[]) rc = read(afd, &buf, sizeof(buf)); if (rc < 0) die("read(): %s\n", strerror(errno)); + + close(afd); } while (rc == 0); unlink(sockpath); -- cgit v1.2.3