These fixes prevent file descriptor leaks in my application. There may still be other potential leak sources in functions that my application does not use.
I tried to implement accept() using accept4() if it is available since that avoids a potential race condition. Same with fcntl(n,F_DUPFD_CLOEXEC,0) instead of dup().
Description
These fixes prevent file descriptor leaks in my application. There may still be other potential leak sources in functions that my application does not use.
I tried to implement
accept()
usingaccept4()
if it is available since that avoids a potential race condition. Same withfcntl(n,F_DUPFD_CLOEXEC,0)
instead ofdup()
.