Don't leak descriptors to sendmail

This commit is contained in:
Miroslav Lichvar
2011-01-18 18:07:46 +01:00
parent 59c68d240c
commit 9d35b5deac
9 changed files with 38 additions and 0 deletions

View File

@@ -121,6 +121,9 @@ prepare_socket(int family)
return -1;
}
/* Close on exec */
UTI_FdSetCloexec(sock_fd);
/* Make the socket capable of re-using an old address */
if (setsockopt(sock_fd, SOL_SOCKET, SO_REUSEADDR, (char *)&on_off, sizeof(on_off)) < 0) {
LOG(LOGS_ERR, LOGF_NtpIO, "Could not set reuseaddr socket options");