mirror of
https://github.com/isc-projects/bind9.git
synced 2026-03-02 13:30:44 -05:00
Change strerror references to use isc__strerror [RT #1689]
This commit is contained in:
parent
05903e6b3a
commit
d5f394f4c4
2 changed files with 17 additions and 7 deletions
|
|
@ -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 <config.h>
|
||||
#include <stdarg.h>
|
||||
|
|
@ -33,6 +33,7 @@
|
|||
|
||||
#include <isc/print.h>
|
||||
#include <isc/result.h>
|
||||
#include <isc/strerror.h>
|
||||
#include <isc/string.h>
|
||||
#include <isc/ntpaths.h>
|
||||
|
||||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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 <config.h>
|
||||
|
||||
|
|
@ -26,6 +26,7 @@
|
|||
#include <isc/msgs.h>
|
||||
#include <isc/net.h>
|
||||
#include <isc/once.h>
|
||||
#include <isc/strerror.h>
|
||||
#include <isc/string.h>
|
||||
#include <isc/util.h>
|
||||
|
||||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue