1
0
mirror of https://passt.top/passt synced 2024-12-22 13:45:32 +00:00

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>
This commit is contained in:
David Gibson 2023-05-23 12:25:43 +10:00 committed by Stefano Brivio
parent 527c822a3b
commit e3b19530e4

View File

@ -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);