cli: Fix missing closing file descriptors

This commit is contained in:
Samuel Thibault 2024-02-04 04:36:09 +01:00
parent 32799f196a
commit fdf19f5467
4 changed files with 42 additions and 5 deletions

12
util.c
View file

@ -108,12 +108,8 @@ pid_t fork_and_close()
if (udpfd[i] != -1) close(udpfd[i]);
}
if (pppoediscfd != -1) close(pppoediscfd);
if (controlfd != -1) close(controlfd);
if (daefd != -1) close(daefd);
if (snoopfd != -1) close(snoopfd);
if (rand_fd != -1) close(rand_fd);
if (epollfd != -1) close(epollfd);
for (i = 0; radfds && i < RADIUS_FDS; i++)
close(radfds[i]);
@ -124,6 +120,14 @@ pid_t fork_and_close()
close(bgp_peers[i].sock);
#endif /* BGP */
if (nlfd != -1) close(nlfd);
if (pppoediscfd != -1) close(pppoediscfd);
if (pppoesessfd != -1) close(pppoesessfd);
if (snoopfd != -1) close(snoopfd);
if (rand_fd != -1) close(rand_fd);
if (epollfd != -1) close(epollfd);
return pid;
}