Make some socket error messages more descriptive

This commit is contained in:
Miroslav Lichvar
2009-11-24 16:52:52 +01:00
parent 618f372e13
commit 3bae6c3202
2 changed files with 10 additions and 6 deletions

View File

@@ -115,7 +115,8 @@ prepare_socket(int family)
#endif
if (sock_fd < 0) {
LOG(LOGS_ERR, LOGF_NtpIO, "Could not open socket : %s", strerror(errno));
LOG(LOGS_ERR, LOGF_NtpIO, "Could not open %s NTP socket : %s",
family == AF_INET ? "IPv4" : "IPv6", strerror(errno));
return -1;
}
@@ -193,7 +194,8 @@ prepare_socket(int family)
#endif
if (bind(sock_fd, &my_addr.u, sizeof(my_addr)) < 0) {
LOG_FATAL(LOGF_NtpIO, "Could not bind socket : %s", strerror(errno));
LOG_FATAL(LOGF_NtpIO, "Could not bind %s NTP socket : %s",
family == AF_INET ? "IPv4" : "IPv6", strerror(errno));
}
/* Register handler for read events on the socket */