* CID 1339962: Explicitly initialize variable in caljulian test. HStenn.
* [Bug 2932] Update leapsecond file info in miscopt.html. CWoodbury, HStenn.
* [Bug 2934] tests/ntpd/t-ntp_scanner.c has a magic constant wired in. HMurray
+* [Bug 2944] errno is not preserved properly in ntpdate after sendto call.
+ - applied patch by Christos Zoulas. perlinger@ntp.org
* [Bug 2954] Version 4.2.8p4 crashes on startup with sig fault
- fixed data race conditions in threaded DNS worker. perlinger@ntp.org
- limit threading warm-up to linux; FreeBSD bombs on it. perlinger@ntp.org
sockaddr_u addr;
size_t octets;
int a_info;
+ int saved_errno;
+
+ saved_errno = socket_errno();
/* reverse the address to purported DNS name */
LIB_GETBUF(pbuf);
gni_flags = NI_DGRAM | NI_NAMEREQD;
if (getnameinfo(&sock->sa, SOCKLEN(sock), pbuf, LIB_BUFLENGTH,
- NULL, 0, gni_flags))
+ NULL, 0, gni_flags)) {
+ errno = saved_errno;
return stoa(sock); /* use address */
+ }
TRACE(1, ("%s reversed to %s\n", stoa(sock), pbuf));
}
freeaddrinfo(alist);
- if (ai != NULL)
+ if (ai != NULL) {
+ errno = saved_errno;
return pbuf; /* forward check passed */
+ }
forward_fail:
TRACE(1, ("%s forward check lookup fail: %s\n", pbuf,
LIB_GETBUF(pliar);
snprintf(pliar, LIB_BUFLENGTH, "%s (%s)", stoa(sock), pbuf);
+ errno = saved_errno;
return pliar;
}