+* Add missing "break;" to ntp_control.c ctl_putsys() for caliberrs, used
+ by ntpq -c kerninfo introduced in 4.2.7p104.
+* Fix leak in ntp_control.c read_mru_list().
(4.2.7p128) 2011/01/30 Released by Harlan Stenn <stenn@ntp.org>
* [Bug 1799] ntpq mrv crash.
* [Bug 1801] ntpq mreadvar requires prior association caching.
#define ALWAYS_INVARIANT(x) calysto_assume(x)
#define ALWAYS_ENSURE(x) calysto_assert(x)
-# elif defined(__COVERITY__)
+/* # elif defined(__COVERITY__) */
+/*
+ * DH: try letting coverity scan our actual assertion macros, now that
+ * isc_assertioncallback_t is marked __attribute__ __noreturn__.
+ */
/*
* Coverity has special knowledge that assert(x) terminates the process
* that seems to be a reasonable trade-off.
*/
+/*
#define ALWAYS_REQUIRE(x) assert(x)
#define ALWAYS_INSIST(x) assert(x)
#define ALWAYS_INVARIANT(x) assert(x)
#define ALWAYS_ENSURE(x) assert(x)
+*/
# else /* neither Coverity nor Calysto */
#ifndef NTP_LISTS_H
#define NTP_LISTS_H
+#include "ntp_types.h" /* TRUE and FALSE */
#include "ntp_assert.h"
-/*
- * For now enable extra debugging code on all builds. Before long, it
- * will probably make sense to only include the debugging #ifdef DEBUG
- */
-#define NTP_DEBUG_LISTS_H
-
/*
* If list debugging is not enabled, save a little time by not clearing
* an entry's link pointer when it is unlinked, as the stale pointer
#define MAYBE_Z_LISTS(p) (p) = NULL
#endif
-#ifndef TRUE
-# define TRUE 1
-# define NTP_LISTS_UNDEF_TRUE
-#endif
-
#define LINK_SLIST(listhead, pentry, nextlink) \
do { \
(pentry)->nextlink = (listhead); \
entrytype **ppentry; \
\
ppentry = &(listhead); \
- while (*ppentry != NULL) { \
- if (beforecur) { \
+ while (TRUE) { \
+ if (NULL == *ppentry || (beforecur)) { \
(pentry)->nextlink = *ppentry; \
*ppentry = (pentry); \
break; \
break; \
} \
} \
-} while (0)
+} while (FALSE)
#define UNLINK_HEAD_SLIST(punlinked, listhead, nextlink) \
do { \
} \
}
-
-#ifdef NTP_LISTS_UNDEF_TRUE
-# undef TRUE
-#endif
-
#endif /* NTP_LISTS_H */
ctl_putint,
(sys_var[varid].text, ntx.errcnt)
);
+ break;
case CS_K_PPS_JITEXC:
CTL_IF_KERNPPS(
while (NULL != (v = ctl_getitem(in_parms, &val)) &&
!(EOV & v->flags)) {
- if (!strcmp(nonce_text, v->text))
+ if (!strcmp(nonce_text, v->text)) {
+ if (NULL != pnonce)
+ free(pnonce);
pnonce = estrdup(val);
- else if (!strcmp(limit_text, v->text))
+ } else if (!strcmp(limit_text, v->text))
sscanf(val, "%u", &limit);
else if (!strcmp(mincount_text, v->text)) {
if (1 != sscanf(val, "%d", &mincount) ||
? "4"
: "6"));
+ if (INVALID_SOCKET == ep->fd)
+ return;
+
/*
* select the local address from which to send to multicast.
*/
switch (AF(&ep->sin)) {
+
case AF_INET :
rc = setsockopt(ep->fd, IPPROTO_IP,
IP_MULTICAST_IF,
"setsockopt IP_MULTICAST_IF %s fails: %m",
stoa(&ep->sin));
break;
+
# ifdef INCLUDE_IPV6_MULTICAST_SUPPORT
case AF_INET6 :
rc = setsockopt(ep->fd, IPPROTO_IPV6,
mon_entry *m
)
{
+ DEBUG_INSIST(NULL != m);
+
UNLINK_DLIST(m, mru);
remove_from_hash(m);
ZERO(*m);
UNLINK_HEAD_SLIST(mon, mon_free, hash_next);
/* Preempt from the MRU list if old enough. */
} else if (ntp_random() / (2. * FRAC) >
- (double)oldest_age / mon_age)
+ (double)oldest_age / mon_age) {
return ~(RES_LIMITED | RES_KOD) & flags;
- else {
+ } else {
mon_reclaim_entry(oldest);
mon = oldest;
}