ntp: close socket when duplicating fails

This commit is contained in:
Miroslav Lichvar 2014-08-06 10:03:16 +02:00
parent 3d57b7a44d
commit b7766478a6

View file

@ -338,6 +338,7 @@ reconnect_socket(int sock_fd, NTP_Remote_Address *remote_addr)
/* Replace the original socket */
if (dup2(fd, sock_fd) != sock_fd) {
DEBUG_LOG(LOGF_NtpIO, "Could not duplicate socket : %s", strerror(errno));
close_socket(fd);
return 0;
}
close_socket(fd);