summaryrefslogtreecommitdiff
path: root/lib/replace
diff options
context:
space:
mode:
Diffstat (limited to 'lib/replace')
-rw-r--r--lib/replace/libreplace.m42
-rw-r--r--lib/replace/replace.c8
-rw-r--r--lib/replace/replace.h5
3 files changed, 14 insertions, 1 deletions
diff --git a/lib/replace/libreplace.m4 b/lib/replace/libreplace.m4
index 8b7a56ecb7..6da209db8a 100644
--- a/lib/replace/libreplace.m4
+++ b/lib/replace/libreplace.m4
@@ -104,7 +104,7 @@ AC_CHECK_HEADERS(sys/mount.h mntent.h)
AC_CHECK_HEADERS(stropts.h)
AC_CHECK_HEADERS(unix.h)
-AC_CHECK_FUNCS(seteuid setresuid setegid setresgid chroot bzero strerror)
+AC_CHECK_FUNCS(seteuid setresuid setegid setresgid chroot bzero strerror strerror_r)
AC_CHECK_FUNCS(vsyslog setlinebuf mktime ftruncate chsize rename)
AC_CHECK_FUNCS(waitpid wait4 strlcpy strlcat initgroups memmove strdup)
AC_CHECK_FUNCS(pread pwrite strndup strcasestr strtok_r mkdtemp dup2 dprintf vdprintf)
diff --git a/lib/replace/replace.c b/lib/replace/replace.c
index e4b97a8913..6a325400f4 100644
--- a/lib/replace/replace.c
+++ b/lib/replace/replace.c
@@ -747,3 +747,11 @@ char *rep_get_current_dir_name(void)
return strdup(p);
}
#endif
+
+#ifndef HAVE_STRERROR_R
+char *rep_strerror_r(int errnum, char *buf, size_t buflen)
+{
+ strncpy(buf, strerror(errnum), buflen);
+ return buf;
+}
+#endif
diff --git a/lib/replace/replace.h b/lib/replace/replace.h
index cd73e65bea..9eb6604c96 100644
--- a/lib/replace/replace.h
+++ b/lib/replace/replace.h
@@ -512,6 +512,11 @@ ssize_t rep_pwrite(int __fd, const void *__buf, size_t __nbytes, off_t __offset)
char *rep_get_current_dir_name(void);
#endif
+#ifndef HAVE_STRERROR_R
+#define strerror_r rep_strerror_r
+char *rep_strerror_r(int errnum, char *buf, size_t buflen);
+#endif
+
#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif