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.c8
-rw-r--r--lib/replace/replace.h5
4 files changed, 15 insertions, 1 deletions
diff --git a/lib/replace/README b/lib/replace/README
index c1cb2d0270..26383bc89a 100644
--- a/lib/replace/README
+++ b/lib/replace/README
@@ -66,6 +66,7 @@ getifaddrs
freeifaddrs
utime
utimes
+dup2
link
readlink
symlink
diff --git a/lib/replace/libreplace.m4 b/lib/replace/libreplace.m4
index c67fa66f5c..30d7017d0f 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 chown lchown link readlink symlink realpath)
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 0683f556eb..78c688d50c 100644
--- a/lib/replace/replace.c
+++ b/lib/replace/replace.c
@@ -616,6 +616,14 @@ int rep_utimes(const char *filename, const struct timeval tv[2])
}
#endif
+#ifndef HAVE_DUP2
+int rep_dup2(int oldfd, int newfd)
+{
+ errno = ENOSYS;
+ return -1;
+}
+#endif
+
#ifndef HAVE_CHOWN
/**
chown isn't used much but OS/2 doesn't have it
diff --git a/lib/replace/replace.h b/lib/replace/replace.h
index d717d6391c..8483d934d8 100644
--- a/lib/replace/replace.h
+++ b/lib/replace/replace.h
@@ -393,6 +393,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>