summaryrefslogtreecommitdiff
path: root/lib/replace
diff options
context:
space:
mode:
Diffstat (limited to 'lib/replace')
-rw-r--r--lib/replace/README1
-rw-r--r--lib/replace/libreplace.m42
-rw-r--r--lib/replace/replace.c9
-rw-r--r--lib/replace/replace.h5
4 files changed, 16 insertions, 1 deletions
diff --git a/lib/replace/README b/lib/replace/README
index 2f3b37340f..108534d29b 100644
--- a/lib/replace/README
+++ b/lib/replace/README
@@ -64,6 +64,7 @@ getifaddrs
freeifaddrs
utime
utimes
+dup2
Types:
bool
diff --git a/lib/replace/libreplace.m4 b/lib/replace/libreplace.m4
index 6f1543863a..6c72cf8a2c 100644
--- a/lib/replace/libreplace.m4
+++ b/lib/replace/libreplace.m4
@@ -107,7 +107,7 @@ AC_CHECK_HEADERS(stropts.h)
AC_CHECK_FUNCS(seteuid setresuid setegid setresgid chroot bzero strerror)
AC_CHECK_FUNCS(vsyslog setlinebuf mktime ftruncate chsize rename)
AC_CHECK_FUNCS(waitpid strlcpy strlcat initgroups memmove strdup)
-AC_CHECK_FUNCS(pread pwrite strndup strcasestr strtok_r mkdtemp)
+AC_CHECK_FUNCS(pread pwrite strndup strcasestr strtok_r mkdtemp dup2)
AC_CHECK_FUNCS(isatty)
AC_HAVE_DECL(setresuid, [#include <unistd.h>])
AC_HAVE_DECL(setresgid, [#include <unistd.h>])
diff --git a/lib/replace/replace.c b/lib/replace/replace.c
index 98d799b07e..4aa84b886d 100644
--- a/lib/replace/replace.c
+++ b/lib/replace/replace.c
@@ -614,3 +614,12 @@ int rep_utimes(const char *filename, const struct timeval tv[2])
return utime(filename, &u);
}
#endif
+
+#ifndef HAVE_DUP2
+int rep_dup2(int oldfd, int newfd)
+{
+ errno = ENOSYS;
+ return -1;
+}
+#endif
+
diff --git a/lib/replace/replace.h b/lib/replace/replace.h
index a8164b642b..70b29722bf 100644
--- a/lib/replace/replace.h
+++ b/lib/replace/replace.h
@@ -358,6 +358,11 @@ struct tm;
char *rep_strptime(const char *buf, const char *format, struct tm *tm);
#endif
+#ifndef HAVE_DUP2
+#define dup2 rep_dup2
+int rep_dup2(int oldfd, int newfd);
+#endif
+
/* Load header file for dynamic linking stuff */
#ifdef HAVE_DLFCN_H
#include <dlfcn.h>