+* [Bug 1339] Fix Windows-only ntp_strerror() infinite recursion.
(4.2.5p231-RC) 2009/10/10 Released by Harlan Stenn <stenn@ntp.org>
* [Bug 1335] Broadcast client degraded by wildcard default change.
(4.2.5p230-RC) 2009/10/09 Released by Harlan Stenn <stenn@ntp.org>
char *
NTstrerror(int err, BOOL *bfreebuf);
-#ifndef CRT_strerror
-#define CRT_strerror(e) strerror(e)
-#endif
+/*
+ * ntp ports/winnt/include/config.h #defines strerror() to
+ * ntp_strerror() to handle OS errors as well as CRT. We need the
+ * CRT strerror() here so #undef.
+ */
+#undef strerror
/*
* We need to do this this way for profiled locks.
return (retmsg);
}
- retmsg = CRT_strerror(errval);
+ retmsg = strerror(errval);
/*
* If it's not one of the standard Unix error codes,
#define STDERR_FILENO _fileno(stderr)
/* Point to a local version for error string handling */
-#define CRT_strerror(e) strerror(e)
#define strerror(e) ntp_strerror(e)
-extern char * ntp_strerror(int);
-
# define MCAST /* Enable Multicast Support */
# define MULTICAST_NONEWSOCKET /* Don't create a new socket for mcast address */
void
NTReportError(const char *, const char *);
+char *
+ntp_strerror(int);
+
#endif
#include <stdlib.h>
#include <syslog.h>
+#include <isc/strerror.h>
+
#include "messages.h"
static HANDLE hAppLog = NULL;
/*
* ntp_strerror() - provide strerror()-compatible wrapper for libisc's
- * NTstrerror(), which knows about Windows as well as
+ * isc__strerror(), which knows about Windows as well as
* C runtime error messages.
*/
-extern char *NTstrerror(int err, BOOL *bfreebuf);
char *
ntp_strerror(
)
{
static char msgbuf[128];
- char * pmsg;
- BOOL freep;
-
- pmsg = NTstrerror(code, &freep);
- strncpy(msgbuf, pmsg, sizeof(msgbuf));
- msgbuf[sizeof(msgbuf) - 1] = '\0';
- if (freep)
- LocalFree(pmsg);
+ isc__strerror(code, msgbuf, sizeof(msgbuf));
return msgbuf;
}