diff --git a/bin/named/win32/os.c b/bin/named/win32/os.c index 2ea5e3ee31..0757ea0922 100644 --- a/bin/named/win32/os.c +++ b/bin/named/win32/os.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: os.c,v 1.10 2001/11/18 03:03:42 mayer Exp $ */ +/* $Id: os.c,v 1.11 2001/11/21 05:07:23 mayer Exp $ */ #include #include @@ -33,6 +33,7 @@ #include #include +#include #include #include @@ -164,6 +165,7 @@ ns_os_writepidfile(const char *filename) { FILE *lockfile; size_t len; pid_t pid; + char strbuf[ISC_STRERRORSIZE]; /* * The caller must ensure any required synchronization. @@ -176,19 +178,22 @@ ns_os_writepidfile(const char *filename) { len = strlen(filename); pidfile = malloc(len + 1); if (pidfile == NULL) + isc__strerror(errno, strbuf, sizeof(strbuf)); ns_main_earlyfatal("couldn't malloc '%s': %s", - filename, strerror(errno)); + filename, strbuf); /* This is safe. */ strcpy(pidfile, filename); fd = safe_open(filename, ISC_FALSE); if (fd < 0) + isc__strerror(errno, strbuf, sizeof(strbuf)); ns_main_earlyfatal("couldn't open pid file '%s': %s", - filename, strerror(errno)); + filename, strbuf); lockfile = fdopen(fd, "w"); if (lockfile == NULL) + isc__strerror(errno, strbuf, sizeof(strbuf)); ns_main_earlyfatal("could not fdopen() pid file '%s': %s", - filename, strerror(errno)); + filename, strbuf); pid = getpid(); if (fprintf(lockfile, "%ld\n", (long)pid) < 0) diff --git a/lib/isc/win32/net.c b/lib/isc/win32/net.c index 53540118f1..2491903236 100644 --- a/lib/isc/win32/net.c +++ b/lib/isc/win32/net.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: net.c,v 1.3 2001/07/09 21:06:12 gson Exp $ */ +/* $Id: net.c,v 1.4 2001/11/21 05:07:25 mayer Exp $ */ #include @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -41,10 +42,13 @@ static isc_result_t try_proto(int domain) { int s; isc_result_t result = ISC_R_SUCCESS; + char strbuf[ISC_STRERRORSIZE]; + int errval; s = socket(domain, SOCK_STREAM, 0); if (s == -1) { - switch (WSAGetLastError()) { + errval = WSAGetLastError(); + switch (errval) { case WSAEAFNOSUPPORT: case WSAEPROTONOSUPPORT: #ifdef EINVAL @@ -52,13 +56,14 @@ try_proto(int domain) { #endif return (ISC_R_NOTFOUND); default: + isc__strerror(errval, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "socket() %s: %s", isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL, ISC_MSG_FAILED, "failed"), - strerror(errno)); + strbuf); return (ISC_R_UNEXPECTED); } }