summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4d0c54c)
raw | patch | inline | side by side (parent: 4d0c54c)
author | Sebastian Harl <sh@tokkee.org> | |
Tue, 13 Dec 2016 22:34:36 +0000 (23:34 +0100) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Tue, 13 Dec 2016 22:34:36 +0000 (23:34 +0100) |
D'oh!
configure.ac | patch | blob | history | |
src/utils/error.c | patch | blob | history |
diff --git a/configure.ac b/configure.ac
index 521f0acb5440961fd58d7a94b63cf67bf19e89a7..4d7ccaece38ca902af25d737637652931599779d 100644 (file)
--- a/configure.ac
+++ b/configure.ac
AC_MSG_RESULT([$have_struct_ucred])
fi
+dnl Only check this after potentially defining _GNU_SOURCE.
+AC_FUNC_STRERROR_R
+
dnl Testing.
PKG_CHECK_MODULES([CHECK], [check >= 0.9.4],
[unit_tests="yes"], [unit_tests="no"])
diff --git a/src/utils/error.c b/src/utils/error.c
index f0a48271c91d75b4a60dfb36b6203374887e83a1..6d23c6bcf68b8e32661e7c49943ccb0c19d9b8b0 100644 (file)
--- a/src/utils/error.c
+++ b/src/utils/error.c
char *
sdb_strerror(int errnum, char *strerrbuf, size_t buflen)
{
+ *strerrbuf = '\0';
+
#if STRERROR_R_CHAR_P
{
char *tmp = strerror_r(errnum, strerrbuf, buflen);
- if (*strerrbuf = '\0') {
+ if (*strerrbuf == '\0') {
if (tmp && (tmp != strerrbuf) && (*tmp != '\0'))
strncpy(strerrbuf, tmp, buflen);
else