diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2023-05-23 12:25:43 +1000 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2023-05-23 17:06:32 +0200 |
commit | e3b19530e4a689f9f8e417ebf737dfca2340342b (patch) | |
tree | f461a8ebc3785640e296735545e0c941f2e4327b | |
parent | 527c822a3bd5536fd6bd52d2821925b8a05c99fb (diff) | |
download | passt-e3b19530e4a689f9f8e417ebf737dfca2340342b.tar passt-e3b19530e4a689f9f8e417ebf737dfca2340342b.tar.gz passt-e3b19530e4a689f9f8e417ebf737dfca2340342b.tar.bz2 passt-e3b19530e4a689f9f8e417ebf737dfca2340342b.tar.lz passt-e3b19530e4a689f9f8e417ebf737dfca2340342b.tar.xz passt-e3b19530e4a689f9f8e417ebf737dfca2340342b.tar.zst passt-e3b19530e4a689f9f8e417ebf737dfca2340342b.zip |
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 <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rw-r--r-- | test/nstool.c | 2 |
1 files changed, 2 insertions, 0 deletions
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); |