Commit 16729357 authored by Ondřej Surý's avatar Ondřej Surý

Use strerror_r from POSIX.1-2001 (strerror_s on Windows) instead of custom isc__strerror()

parent efd613e8
...@@ -40,7 +40,6 @@ ...@@ -40,7 +40,6 @@
#include <isc/print.h> #include <isc/print.h>
#include <isc/resource.h> #include <isc/resource.h>
#include <isc/result.h> #include <isc/result.h>
#include <isc/strerror.h>
#include <isc/string.h> #include <isc/string.h>
#include <named/globals.h> #include <named/globals.h>
...@@ -130,7 +129,7 @@ linux_setcaps(cap_t caps) { ...@@ -130,7 +129,7 @@ linux_setcaps(cap_t caps) {
return; return;
} }
if (cap_set_proc(caps) < 0) { if (cap_set_proc(caps) < 0) {
isc__strerror(errno, strbuf, sizeof(strbuf)); strerror_r(errno, strbuf, sizeof(strbuf));
named_main_earlyfatal("cap_set_proc() failed: %s:" named_main_earlyfatal("cap_set_proc() failed: %s:"
" please ensure that the capset kernel" " please ensure that the capset kernel"
" module is loaded. see insmod(8)", " module is loaded. see insmod(8)",
...@@ -146,13 +145,13 @@ linux_setcaps(cap_t caps) { ...@@ -146,13 +145,13 @@ linux_setcaps(cap_t caps) {
if (err != -1 && curval) { \ if (err != -1 && curval) { \
err = cap_set_flag(caps, CAP_EFFECTIVE, 1, &capval, CAP_SET); \ err = cap_set_flag(caps, CAP_EFFECTIVE, 1, &capval, CAP_SET); \
if (err == -1) { \ if (err == -1) { \
isc__strerror(errno, strbuf, sizeof(strbuf)); \ strerror_r(errno, strbuf, sizeof(strbuf)); \
named_main_earlyfatal("cap_set_proc failed: %s", strbuf); \ named_main_earlyfatal("cap_set_proc failed: %s", strbuf); \
} \ } \
\ \
err = cap_set_flag(caps, CAP_PERMITTED, 1, &capval, CAP_SET); \ err = cap_set_flag(caps, CAP_PERMITTED, 1, &capval, CAP_SET); \
if (err == -1) { \ if (err == -1) { \
isc__strerror(errno, strbuf, sizeof(strbuf)); \ strerror_r(errno, strbuf, sizeof(strbuf)); \
named_main_earlyfatal("cap_set_proc failed: %s", strbuf); \ named_main_earlyfatal("cap_set_proc failed: %s", strbuf); \
} \ } \
} \ } \
...@@ -161,12 +160,12 @@ linux_setcaps(cap_t caps) { ...@@ -161,12 +160,12 @@ linux_setcaps(cap_t caps) {
do { \ do { \
caps = cap_init(); \ caps = cap_init(); \
if (caps == NULL) { \ if (caps == NULL) { \
isc__strerror(errno, strbuf, sizeof(strbuf)); \ strerror_r(errno, strbuf, sizeof(strbuf)); \
named_main_earlyfatal("cap_init failed: %s", strbuf); \ named_main_earlyfatal("cap_init failed: %s", strbuf); \
} \ } \
curcaps = cap_get_proc(); \ curcaps = cap_get_proc(); \
if (curcaps == NULL) { \ if (curcaps == NULL) { \
isc__strerror(errno, strbuf, sizeof(strbuf)); \ strerror_r(errno, strbuf, sizeof(strbuf)); \
named_main_earlyfatal("cap_get_proc failed: %s", strbuf); \ named_main_earlyfatal("cap_get_proc failed: %s", strbuf); \
} \ } \
} while (0) } while (0)
...@@ -286,7 +285,7 @@ linux_keepcaps(void) { ...@@ -286,7 +285,7 @@ linux_keepcaps(void) {
if (prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0) < 0) { if (prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0) < 0) {
if (errno != EINVAL) { if (errno != EINVAL) {
isc__strerror(errno, strbuf, sizeof(strbuf)); strerror_r(errno, strbuf, sizeof(strbuf));
named_main_earlyfatal("prctl() failed: %s", strbuf); named_main_earlyfatal("prctl() failed: %s", strbuf);
} }
} else { } else {
...@@ -331,13 +330,13 @@ named_os_daemonize(void) { ...@@ -331,13 +330,13 @@ named_os_daemonize(void) {
char strbuf[ISC_STRERRORSIZE]; char strbuf[ISC_STRERRORSIZE];
if (pipe(dfd) == -1) { if (pipe(dfd) == -1) {
isc__strerror(errno, strbuf, sizeof(strbuf)); strerror_r(errno, strbuf, sizeof(strbuf));
named_main_earlyfatal("pipe(): %s", strbuf); named_main_earlyfatal("pipe(): %s", strbuf);
} }
pid = fork(); pid = fork();
if (pid == -1) { if (pid == -1) {
isc__strerror(errno, strbuf, sizeof(strbuf)); strerror_r(errno, strbuf, sizeof(strbuf));
named_main_earlyfatal("fork(): %s", strbuf); named_main_earlyfatal("fork(): %s", strbuf);
} }
if (pid != 0) { if (pid != 0) {
...@@ -367,7 +366,7 @@ named_os_daemonize(void) { ...@@ -367,7 +366,7 @@ named_os_daemonize(void) {
#endif #endif
if (setsid() == -1) { if (setsid() == -1) {
isc__strerror(errno, strbuf, sizeof(strbuf)); strerror_r(errno, strbuf, sizeof(strbuf));
named_main_earlyfatal("setsid(): %s", strbuf); named_main_earlyfatal("setsid(): %s", strbuf);
} }
...@@ -450,14 +449,14 @@ named_os_chroot(const char *root) { ...@@ -450,14 +449,14 @@ named_os_chroot(const char *root) {
if (root != NULL) { if (root != NULL) {
#ifdef HAVE_CHROOT #ifdef HAVE_CHROOT
if (chroot(root) < 0) { if (chroot(root) < 0) {
isc__strerror(errno, strbuf, sizeof(strbuf)); strerror_r(errno, strbuf, sizeof(strbuf));
named_main_earlyfatal("chroot(): %s", strbuf); named_main_earlyfatal("chroot(): %s", strbuf);
} }
#else #else
named_main_earlyfatal("chroot(): disabled"); named_main_earlyfatal("chroot(): disabled");
#endif #endif
if (chdir("/") < 0) { if (chdir("/") < 0) {
isc__strerror(errno, strbuf, sizeof(strbuf)); strerror_r(errno, strbuf, sizeof(strbuf));
named_main_earlyfatal("chdir(/): %s", strbuf); named_main_earlyfatal("chdir(/): %s", strbuf);
} }
#ifdef HAVE_LIBSCF #ifdef HAVE_LIBSCF
...@@ -484,7 +483,7 @@ named_os_inituserinfo(const char *username) { ...@@ -484,7 +483,7 @@ named_os_inituserinfo(const char *username) {
if (getuid() == 0) { if (getuid() == 0) {
if (initgroups(runas_pw->pw_name, runas_pw->pw_gid) < 0) { if (initgroups(runas_pw->pw_name, runas_pw->pw_gid) < 0) {
isc__strerror(errno, strbuf, sizeof(strbuf)); strerror_r(errno, strbuf, sizeof(strbuf));
named_main_earlyfatal("initgroups(): %s", strbuf); named_main_earlyfatal("initgroups(): %s", strbuf);
} }
} }
...@@ -514,12 +513,12 @@ named_os_changeuser(void) { ...@@ -514,12 +513,12 @@ named_os_changeuser(void) {
#endif #endif
if (setgid(runas_pw->pw_gid) < 0) { if (setgid(runas_pw->pw_gid) < 0) {
isc__strerror(errno, strbuf, sizeof(strbuf)); strerror_r(errno, strbuf, sizeof(strbuf));
named_main_earlyfatal("setgid(): %s", strbuf); named_main_earlyfatal("setgid(): %s", strbuf);
} }
if (setuid(runas_pw->pw_uid) < 0) { if (setuid(runas_pw->pw_uid) < 0) {
isc__strerror(errno, strbuf, sizeof(strbuf)); strerror_r(errno, strbuf, sizeof(strbuf));
named_main_earlyfatal("setuid(): %s", strbuf); named_main_earlyfatal("setuid(): %s", strbuf);
} }
...@@ -529,7 +528,7 @@ named_os_changeuser(void) { ...@@ -529,7 +528,7 @@ named_os_changeuser(void) {
* call has disabled it. * call has disabled it.
*/ */
if (prctl(PR_SET_DUMPABLE,1,0,0,0) < 0) { if (prctl(PR_SET_DUMPABLE,1,0,0,0) < 0) {
isc__strerror(errno, strbuf, sizeof(strbuf)); strerror_r(errno, strbuf, sizeof(strbuf));
named_main_earlywarning("prctl(PR_SET_DUMPABLE) failed: %s", named_main_earlywarning("prctl(PR_SET_DUMPABLE) failed: %s",
strbuf); strbuf);
} }
...@@ -648,7 +647,7 @@ mkdirpath(char *filename, void (*report)(const char *, ...)) { ...@@ -648,7 +647,7 @@ mkdirpath(char *filename, void (*report)(const char *, ...)) {
if (stat(filename, &sb) == -1) { if (stat(filename, &sb) == -1) {
if (errno != ENOENT) { if (errno != ENOENT) {
isc__strerror(errno, strbuf, sizeof(strbuf)); strerror_r(errno, strbuf, sizeof(strbuf));
(*report)("couldn't stat '%s': %s", filename, (*report)("couldn't stat '%s': %s", filename,
strbuf); strbuf);
goto error; goto error;
...@@ -668,7 +667,7 @@ mkdirpath(char *filename, void (*report)(const char *, ...)) { ...@@ -668,7 +667,7 @@ mkdirpath(char *filename, void (*report)(const char *, ...)) {
mode |= S_IRGRP | S_IXGRP; /* g=rx */ mode |= S_IRGRP | S_IXGRP; /* g=rx */
mode |= S_IROTH | S_IXOTH; /* o=rx */ mode |= S_IROTH | S_IXOTH; /* o=rx */
if (mkdir(filename, mode) == -1) { if (mkdir(filename, mode) == -1) {
isc__strerror(errno, strbuf, sizeof(strbuf)); strerror_r(errno, strbuf, sizeof(strbuf));
(*report)("couldn't mkdir '%s': %s", filename, (*report)("couldn't mkdir '%s': %s", filename,
strbuf); strbuf);
goto error; goto error;
...@@ -676,7 +675,7 @@ mkdirpath(char *filename, void (*report)(const char *, ...)) { ...@@ -676,7 +675,7 @@ mkdirpath(char *filename, void (*report)(const char *, ...)) {
if (runas_pw != NULL && if (runas_pw != NULL &&
chown(filename, runas_pw->pw_uid, chown(filename, runas_pw->pw_uid,
runas_pw->pw_gid) == -1) { runas_pw->pw_gid) == -1) {
isc__strerror(errno, strbuf, sizeof(strbuf)); strerror_r(errno, strbuf, sizeof(strbuf));
(*report)("couldn't chown '%s': %s", filename, (*report)("couldn't chown '%s': %s", filename,
strbuf); strbuf);
} }
...@@ -703,7 +702,7 @@ setperms(uid_t uid, gid_t gid) { ...@@ -703,7 +702,7 @@ setperms(uid_t uid, gid_t gid) {
#endif #endif
#if defined(HAVE_SETEGID) #if defined(HAVE_SETEGID)
if (getegid() != gid && setegid(gid) == -1) { if (getegid() != gid && setegid(gid) == -1) {
isc__strerror(errno, strbuf, sizeof(strbuf)); strerror_r(errno, strbuf, sizeof(strbuf));
named_main_earlywarning("unable to set effective " named_main_earlywarning("unable to set effective "
"gid to %ld: %s", "gid to %ld: %s",
(long)gid, strbuf); (long)gid, strbuf);
...@@ -711,7 +710,7 @@ setperms(uid_t uid, gid_t gid) { ...@@ -711,7 +710,7 @@ setperms(uid_t uid, gid_t gid) {
#elif defined(HAVE_SETRESGID) #elif defined(HAVE_SETRESGID)
if (getresgid(&tmpg, &oldgid, &tmpg) == -1 || oldgid != gid) { if (getresgid(&tmpg, &oldgid, &tmpg) == -1 || oldgid != gid) {
if (setresgid(-1, gid, -1) == -1) { if (setresgid(-1, gid, -1) == -1) {
isc__strerror(errno, strbuf, sizeof(strbuf)); strerror_r(errno, strbuf, sizeof(strbuf));
named_main_earlywarning("unable to set effective " named_main_earlywarning("unable to set effective "
"gid to %d: %s", gid, strbuf); "gid to %d: %s", gid, strbuf);
} }
...@@ -720,7 +719,7 @@ setperms(uid_t uid, gid_t gid) { ...@@ -720,7 +719,7 @@ setperms(uid_t uid, gid_t gid) {
#if defined(HAVE_SETEUID) #if defined(HAVE_SETEUID)
if (geteuid() != uid && seteuid(uid) == -1) { if (geteuid() != uid && seteuid(uid) == -1) {
isc__strerror(errno, strbuf, sizeof(strbuf)); strerror_r(errno, strbuf, sizeof(strbuf));
named_main_earlywarning("unable to set effective " named_main_earlywarning("unable to set effective "
"uid to %ld: %s", "uid to %ld: %s",
(long)uid, strbuf); (long)uid, strbuf);
...@@ -728,7 +727,7 @@ setperms(uid_t uid, gid_t gid) { ...@@ -728,7 +727,7 @@ setperms(uid_t uid, gid_t gid) {
#elif defined(HAVE_SETRESUID) #elif defined(HAVE_SETRESUID)
if (getresuid(&tmpu, &olduid, &tmpu) == -1 || olduid != uid) { if (getresuid(&tmpu, &olduid, &tmpu) == -1 || olduid != uid) {
if (setresuid(-1, uid, -1) == -1) { if (setresuid(-1, uid, -1) == -1) {
isc__strerror(errno, strbuf, sizeof(strbuf)); strerror_r(errno, strbuf, sizeof(strbuf));
named_main_earlywarning("unable to set effective " named_main_earlywarning("unable to set effective "
"uid to %d: %s", uid, strbuf); "uid to %d: %s", uid, strbuf);
} }
...@@ -747,7 +746,7 @@ named_os_openfile(const char *filename, mode_t mode, bool switch_user) { ...@@ -747,7 +746,7 @@ named_os_openfile(const char *filename, mode_t mode, bool switch_user) {
*/ */
f = strdup(filename); f = strdup(filename);
if (f == NULL) { if (f == NULL) {
isc__strerror(errno, strbuf, sizeof(strbuf)); strerror_r(errno, strbuf, sizeof(strbuf));
named_main_earlywarning("couldn't strdup() '%s': %s", named_main_earlywarning("couldn't strdup() '%s': %s",
filename, strbuf); filename, strbuf);
return (NULL); return (NULL);
...@@ -799,7 +798,7 @@ named_os_openfile(const char *filename, mode_t mode, bool switch_user) { ...@@ -799,7 +798,7 @@ named_os_openfile(const char *filename, mode_t mode, bool switch_user) {
} }
if (fd < 0) { if (fd < 0) {
isc__strerror(errno, strbuf, sizeof(strbuf)); strerror_r(errno, strbuf, sizeof(strbuf));
named_main_earlywarning("could not open file '%s': %s", named_main_earlywarning("could not open file '%s': %s",
filename, strbuf); filename, strbuf);
return (NULL); return (NULL);
...@@ -807,7 +806,7 @@ named_os_openfile(const char *filename, mode_t mode, bool switch_user) { ...@@ -807,7 +806,7 @@ named_os_openfile(const char *filename, mode_t mode, bool switch_user) {
fp = fdopen(fd, "w"); fp = fdopen(fd, "w");
if (fp == NULL) { if (fp == NULL) {
isc__strerror(errno, strbuf, sizeof(strbuf)); strerror_r(errno, strbuf, sizeof(strbuf));
named_main_earlywarning("could not fdopen() file '%s': %s", named_main_earlywarning("could not fdopen() file '%s': %s",
filename, strbuf); filename, strbuf);
} }
...@@ -835,7 +834,7 @@ named_os_writepidfile(const char *filename, bool first_time) { ...@@ -835,7 +834,7 @@ named_os_writepidfile(const char *filename, bool first_time) {
pidfile = strdup(filename); pidfile = strdup(filename);
if (pidfile == NULL) { if (pidfile == NULL) {
isc__strerror(errno, strbuf, sizeof(strbuf)); strerror_r(errno, strbuf, sizeof(strbuf));
(*report)("couldn't strdup() '%s': %s", filename, strbuf); (*report)("couldn't strdup() '%s': %s", filename, strbuf);
return; return;
} }
...@@ -882,7 +881,7 @@ named_os_issingleton(const char *filename) { ...@@ -882,7 +881,7 @@ named_os_issingleton(const char *filename) {
*/ */
lockfile = strdup(filename); lockfile = strdup(filename);
if (lockfile == NULL) { if (lockfile == NULL) {
isc__strerror(errno, strbuf, sizeof(strbuf)); strerror_r(errno, strbuf, sizeof(strbuf));
named_main_earlyfatal("couldn't allocate memory for '%s': %s", named_main_earlyfatal("couldn't allocate memory for '%s': %s",
filename, strbuf); filename, strbuf);
} else { } else {
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
#include <isc/print.h> #include <isc/print.h>
#include <isc/result.h> #include <isc/result.h>
#include <isc/strerror.h>
#include <isc/string.h> #include <isc/string.h>
#include <isc/ntpaths.h> #include <isc/ntpaths.h>
#include <isc/util.h> #include <isc/util.h>
...@@ -231,7 +230,7 @@ named_os_openfile(const char *filename, int mode, bool switch_user) { ...@@ -231,7 +230,7 @@ named_os_openfile(const char *filename, int mode, bool switch_user) {
UNUSED(switch_user); UNUSED(switch_user);
fd = safe_open(filename, mode, false); fd = safe_open(filename, mode, false);
if (fd < 0) { if (fd < 0) {
isc__strerror(errno, strbuf, sizeof(strbuf)); strerror_s(strbuf, sizeof(strbuf), errno);
named_main_earlywarning("could not open file '%s': %s", named_main_earlywarning("could not open file '%s': %s",
filename, strbuf); filename, strbuf);
return (NULL); return (NULL);
...@@ -239,7 +238,7 @@ named_os_openfile(const char *filename, int mode, bool switch_user) { ...@@ -239,7 +238,7 @@ named_os_openfile(const char *filename, int mode, bool switch_user) {
fp = fdopen(fd, "w"); fp = fdopen(fd, "w");
if (fp == NULL) { if (fp == NULL) {
isc__strerror(errno, strbuf, sizeof(strbuf)); strerror_s(strbuf, sizeof(strbuf), errno);
named_main_earlywarning("could not fdopen() file '%s': %s", named_main_earlywarning("could not fdopen() file '%s': %s",
filename, strbuf); filename, strbuf);
close(fd); close(fd);
...@@ -268,7 +267,7 @@ named_os_writepidfile(const char *filename, bool first_time) { ...@@ -268,7 +267,7 @@ named_os_writepidfile(const char *filename, bool first_time) {
pidfile = strdup(filename); pidfile = strdup(filename);
if (pidfile == NULL) { if (pidfile == NULL) {
isc__strerror(errno, strbuf, sizeof(strbuf)); strerror_s(strbuf, sizeof(strbuf), errno);
(*report)("couldn't strdup() '%s': %s", filename, strbuf); (*report)("couldn't strdup() '%s': %s", filename, strbuf);
return; return;
} }
...@@ -312,7 +311,7 @@ named_os_issingleton(const char *filename) { ...@@ -312,7 +311,7 @@ named_os_issingleton(const char *filename) {
lockfile = strdup(filename); lockfile = strdup(filename);
if (lockfile == NULL) { if (lockfile == NULL) {
isc__strerror(errno, strbuf, sizeof(strbuf)); strerror_s(strbuf, sizeof(strbuf), errno);
named_main_earlyfatal("couldn't allocate memory for '%s': %s", named_main_earlyfatal("couldn't allocate memory for '%s': %s",
filename, strbuf); filename, strbuf);
} }
......
...@@ -2085,8 +2085,6 @@ then ...@@ -2085,8 +2085,6 @@ then
AC_CHECK_HEADERS(readline/history.h) AC_CHECK_HEADERS(readline/history.h)
fi fi
AC_CHECK_FUNC(strerror, AC_DEFINE(HAVE_STRERROR))
# #
# Use our own SPNEGO implementation? # Use our own SPNEGO implementation?
# #
......
...@@ -35,7 +35,6 @@ ...@@ -35,7 +35,6 @@
#include <isc/result.h> #include <isc/result.h>
#include <isc/string.h> #include <isc/string.h>
#include <isc/util.h> #include <isc/util.h>
#include <isc/strerror.h>
#include <dns/fixedname.h> #include <dns/fixedname.h>
#include <dns/name.h> #include <dns/name.h>
...@@ -82,7 +81,7 @@ ux_socket_connect(const char *path) { ...@@ -82,7 +81,7 @@ ux_socket_connect(const char *path) {
fd = socket(AF_UNIX, SOCK_STREAM, 0); fd = socket(AF_UNIX, SOCK_STREAM, 0);
if (fd == -1) { if (fd == -1) {
char strbuf[ISC_STRERRORSIZE]; char strbuf[ISC_STRERRORSIZE];
isc__strerror(errno, strbuf, sizeof(strbuf)); strerror_r(errno, strbuf, sizeof(strbuf));
ssu_e_log(3, "ssu_external: unable to create socket - %s", ssu_e_log(3, "ssu_external: unable to create socket - %s",
strbuf); strbuf);
return (-1); return (-1);
...@@ -90,7 +89,7 @@ ux_socket_connect(const char *path) { ...@@ -90,7 +89,7 @@ ux_socket_connect(const char *path) {
if (connect(fd, (struct sockaddr *)&addr, sizeof(addr)) == -1) { if (connect(fd, (struct sockaddr *)&addr, sizeof(addr)) == -1) {
char strbuf[ISC_STRERRORSIZE]; char strbuf[ISC_STRERRORSIZE];
isc__strerror(errno, strbuf, sizeof(strbuf)); strerror_r(errno, strbuf, sizeof(strbuf));
ssu_e_log(3, "ssu_external: unable to connect to " ssu_e_log(3, "ssu_external: unable to connect to "
"socket '%s' - %s", "socket '%s' - %s",
path, strbuf); path, strbuf);
...@@ -224,7 +223,7 @@ dns_ssu_external_match(const dns_name_t *identity, ...@@ -224,7 +223,7 @@ dns_ssu_external_match(const dns_name_t *identity,
isc_mem_free(mctx, data); isc_mem_free(mctx, data);
if (ret != (ssize_t) req_len) { if (ret != (ssize_t) req_len) {
char strbuf[ISC_STRERRORSIZE]; char strbuf[ISC_STRERRORSIZE];
isc__strerror(errno, strbuf, sizeof(strbuf)); strerror_r(errno, strbuf, sizeof(strbuf));
ssu_e_log(3, "ssu_external: unable to send request - %s", ssu_e_log(3, "ssu_external: unable to send request - %s",
strbuf); strbuf);
close(fd); close(fd);
...@@ -235,7 +234,7 @@ dns_ssu_external_match(const dns_name_t *identity, ...@@ -235,7 +234,7 @@ dns_ssu_external_match(const dns_name_t *identity,
ret = read(fd, &reply, sizeof(uint32_t)); ret = read(fd, &reply, sizeof(uint32_t));
if (ret != (ssize_t) sizeof(uint32_t)) { if (ret != (ssize_t) sizeof(uint32_t)) {
char strbuf[ISC_STRERRORSIZE]; char strbuf[ISC_STRERRORSIZE];
isc__strerror(errno, strbuf, sizeof(strbuf)); strerror_r(errno, strbuf, sizeof(strbuf));
ssu_e_log(3, "ssu_external: unable to receive reply - %s", ssu_e_log(3, "ssu_external: unable to receive reply - %s",
strbuf); strbuf);
close(fd); close(fd);
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#include <isc/serial.h> #include <isc/serial.h>
#include <isc/stats.h> #include <isc/stats.h>
#include <isc/stdtime.h> #include <isc/stdtime.h>
#include <isc/strerror.h>
#include <isc/string.h> #include <isc/string.h>
#include <isc/taskpool.h> #include <isc/taskpool.h>
#include <isc/thread.h> #include <isc/thread.h>
...@@ -4593,7 +4592,7 @@ zone_postload(dns_zone_t *zone, dns_db_t *db, isc_time_t loadtime, ...@@ -4593,7 +4592,7 @@ zone_postload(dns_zone_t *zone, dns_db_t *db, isc_time_t loadtime,
"removing journal file"); "removing journal file");
if (remove(zone->journal) < 0 && errno != ENOENT) { if (remove(zone->journal) < 0 && errno != ENOENT) {
char strbuf[ISC_STRERRORSIZE]; char strbuf[ISC_STRERRORSIZE];
isc__strerror(errno, strbuf, sizeof(strbuf)); strerror_r(errno, strbuf, sizeof(strbuf));
isc_log_write(dns_lctx, isc_log_write(dns_lctx,
DNS_LOGCATEGORY_GENERAL, DNS_LOGCATEGORY_GENERAL,
DNS_LOGMODULE_ZONE, DNS_LOGMODULE_ZONE,
...@@ -15112,7 +15111,7 @@ zone_replacedb(dns_zone_t *zone, dns_db_t *db, bool dump) { ...@@ -15112,7 +15111,7 @@ zone_replacedb(dns_zone_t *zone, dns_db_t *db, bool dump) {
zone->journal); zone->journal);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
char strbuf[ISC_STRERRORSIZE]; char strbuf[ISC_STRERRORSIZE];
isc__strerror(errno, strbuf, sizeof(strbuf)); strerror_r(errno, strbuf, sizeof(strbuf));
dns_zone_log(zone, ISC_LOG_ERROR, dns_zone_log(zone, ISC_LOG_ERROR,
"ixfr-from-differences: failed: " "ixfr-from-differences: failed: "
"%s", strbuf); "%s", strbuf);
...@@ -15134,7 +15133,7 @@ zone_replacedb(dns_zone_t *zone, dns_db_t *db, bool dump) { ...@@ -15134,7 +15133,7 @@ zone_replacedb(dns_zone_t *zone, dns_db_t *db, bool dump) {
if (DNS_ZONE_FLAG(zone, DNS_ZONEFLG_FORCEXFER) && if (DNS_ZONE_FLAG(zone, DNS_ZONEFLG_FORCEXFER) &&
remove(zone->masterfile) < 0 && errno != ENOENT) { remove(zone->masterfile) < 0 && errno != ENOENT) {
char strbuf[ISC_STRERRORSIZE]; char strbuf[ISC_STRERRORSIZE];
isc__strerror(errno, strbuf, sizeof(strbuf)); strerror_r(errno, strbuf, sizeof(strbuf));
isc_log_write(dns_lctx, isc_log_write(dns_lctx,
DNS_LOGCATEGORY_GENERAL, DNS_LOGCATEGORY_GENERAL,
DNS_LOGMODULE_ZONE, DNS_LOGMODULE_ZONE,
...@@ -15165,7 +15164,7 @@ zone_replacedb(dns_zone_t *zone, dns_db_t *db, bool dump) { ...@@ -15165,7 +15164,7 @@ zone_replacedb(dns_zone_t *zone, dns_db_t *db, bool dump) {
"removing journal file"); "removing journal file");
if (remove(zone->journal) < 0 && errno != ENOENT) { if (remove(zone->journal) < 0 && errno != ENOENT) {
char strbuf[ISC_STRERRORSIZE]; char strbuf[ISC_STRERRORSIZE];
isc__strerror(errno, strbuf, sizeof(strbuf)); strerror_r(errno, strbuf, sizeof(strbuf));
isc_log_write(dns_lctx, isc_log_write(dns_lctx,
DNS_LOGCATEGORY_GENERAL, DNS_LOGCATEGORY_GENERAL,
DNS_LOGMODULE_ZONE, DNS_LOGMODULE_ZONE,
......
...@@ -31,7 +31,7 @@ UNIXOBJS = unix/pk11_api.@O@ \ ...@@ -31,7 +31,7 @@ UNIXOBJS = unix/pk11_api.@O@ \
unix/errno2result.@O@ unix/file.@O@ unix/fsaccess.@O@ \ unix/errno2result.@O@ unix/file.@O@ unix/fsaccess.@O@ \
unix/interfaceiter.@O@ unix/keyboard.@O@ unix/meminfo.@O@ \ unix/interfaceiter.@O@ unix/keyboard.@O@ unix/meminfo.@O@ \
unix/net.@O@ unix/os.@O@ unix/resource.@O@ unix/socket.@O@ \ unix/net.@O@ unix/os.@O@ unix/resource.@O@ unix/socket.@O@ \
unix/stdio.@O@ unix/stdtime.@O@ unix/strerror.@O@ \ unix/stdio.@O@ unix/stdtime.@O@ \
unix/syslog.@O@ unix/time.@O@ unix/syslog.@O@ unix/time.@O@
NLSOBJS = nls/msgcat.@O@ NLSOBJS = nls/msgcat.@O@
......
...@@ -26,6 +26,12 @@ ...@@ -26,6 +26,12 @@
#define thread_local __thread #define thread_local __thread
#endif #endif
/***
*** Default strerror_r buffer size
***/
#define ISC_STRERRORSIZE 128
/*** /***
*** Network. *** Network.
***/ ***/
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
#include <isc/condition.h> #include <isc/condition.h>
#include <isc/msgs.h> #include <isc/msgs.h>
#include <isc/strerror.h>
#include <isc/string.h> #include <isc/string.h>
#include <isc/time.h> #include <isc/time.h>
#include <isc/util.h> #include <isc/util.h>
...@@ -64,7 +63,7 @@ isc_condition_waituntil(isc_condition_t *c, isc_mutex_t *m, isc_time_t *t) { ...@@ -64,7 +63,7 @@ isc_condition_waituntil(isc_condition_t *c, isc_mutex_t *m, isc_time_t *t) {
return (ISC_R_TIMEDOUT); return (ISC_R_TIMEDOUT);
} while (presult == EINTR); } while (presult == EINTR);
isc__strerror(presult, strbuf, sizeof(strbuf)); strerror_r(presult, strbuf, sizeof(strbuf));
UNEXPECTED_ERROR(__FILE__, __LINE__, UNEXPECTED_ERROR(__FILE__, __LINE__,
"pthread_cond_timedwait() %s %s", "pthread_cond_timedwait() %s %s",
isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL, isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <stdbool.h> #include <stdbool.h>
#include <stdio.h> #include <stdio.h>
#include <string.h>
#include <time.h> #include <time.h>
#include <sys/time.h> #include <sys/time.h>
#include <errno.h> #include <errno.h>
...@@ -23,7 +24,6 @@ ...@@ -23,7 +24,6 @@
#include <isc/mutex.h> #include <isc/mutex.h>
#include <isc/util.h> #include <isc/util.h>