summaryrefslogtreecommitdiff
path: root/lib/replace
diff options
context:
space:
mode:
Diffstat (limited to 'lib/replace')
-rw-r--r--lib/replace/libreplace.m44
-rw-r--r--lib/replace/replace.c12
-rw-r--r--lib/replace/samba.m42
-rw-r--r--lib/replace/system/filesys.h4
-rw-r--r--lib/replace/system/wait.h4
-rw-r--r--lib/replace/test/os2_delete.c4
6 files changed, 25 insertions, 5 deletions
diff --git a/lib/replace/libreplace.m4 b/lib/replace/libreplace.m4
index 30d7017d0f..2d90d9c7e8 100644
--- a/lib/replace/libreplace.m4
+++ b/lib/replace/libreplace.m4
@@ -106,7 +106,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(waitpid wait4 strlcpy strlcat initgroups memmove strdup)
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>])
@@ -279,7 +279,7 @@ m4_include(timegm.m4)
m4_include(repdir.m4)
m4_include(crypt.m4)
-AC_CHECK_FUNCS([syslog printf memset memcpy],,[AC_MSG_ERROR([Required function not found])])
+AC_CHECK_FUNCS([printf memset memcpy],,[AC_MSG_ERROR([Required function not found])])
echo "LIBREPLACE_BROKEN_CHECKS: END"
]) dnl end AC_LIBREPLACE_BROKEN_CHECKS
diff --git a/lib/replace/replace.c b/lib/replace/replace.c
index 78c688d50c..fc15717349 100644
--- a/lib/replace/replace.c
+++ b/lib/replace/replace.c
@@ -31,6 +31,10 @@
#include "system/locale.h"
#include "system/wait.h"
+#ifdef _WIN32
+#define mkdir(d,m) _mkdir(d)
+#endif
+
void replace_dummy(void);
void replace_dummy(void) {}
@@ -355,7 +359,7 @@ char *rep_strndup(const char *s, size_t n)
}
#endif
-#ifndef HAVE_WAITPID
+#if !defined(HAVE_WAITPID) && defined(HAVE_WAIT4)
int rep_waitpid(pid_t pid,int *status,int options)
{
return wait4(pid, status, options, NULL);
@@ -368,7 +372,8 @@ int rep_seteuid(uid_t euid)
#ifdef HAVE_SETRESUID
return setresuid(-1, euid, -1);
#else
-# error "You need a seteuid function"
+ errno = ENOSYS;
+ return -1;
#endif
}
#endif
@@ -379,7 +384,8 @@ int rep_setegid(gid_t egid)
#ifdef HAVE_SETRESGID
return setresgid(-1, egid, -1);
#else
-# error "You need a setegid function"
+ errno = ENOSYS;
+ return -1;
#endif
}
#endif
diff --git a/lib/replace/samba.m4 b/lib/replace/samba.m4
index ccb6f2e20d..4514728d03 100644
--- a/lib/replace/samba.m4
+++ b/lib/replace/samba.m4
@@ -33,3 +33,5 @@ SMB_SUBSYSTEM(LIBREPLACE_HOSTCC,
[${LIBREPLACE_HOSTCC_OBJS}],
[],
[-Ilib/replace])
+
+AC_CHECK_FUNCS([syslog],,[AC_MSG_ERROR([Required function not found])])
diff --git a/lib/replace/system/filesys.h b/lib/replace/system/filesys.h
index 4bf1f64865..1cf6f231b7 100644
--- a/lib/replace/system/filesys.h
+++ b/lib/replace/system/filesys.h
@@ -179,4 +179,8 @@
#define SEEK_SET 0
#endif
+#ifdef _WIN32
+#define mkdir(d,m) _mkdir(d)
+#endif
+
#endif
diff --git a/lib/replace/system/wait.h b/lib/replace/system/wait.h
index 5784b1ae92..79583ad2ab 100644
--- a/lib/replace/system/wait.h
+++ b/lib/replace/system/wait.h
@@ -52,4 +52,8 @@
typedef int sig_atomic_t;
#endif
+#if !defined(HAVE_WAITPID) && defined(HAVE_WAIT4)
+int rep_waitpid(pid_t pid,int *status,int options)
+#endif
+
#endif
diff --git a/lib/replace/test/os2_delete.c b/lib/replace/test/os2_delete.c
index 44efeea08a..8b52837018 100644
--- a/lib/replace/test/os2_delete.c
+++ b/lib/replace/test/os2_delete.c
@@ -27,6 +27,10 @@ static int test_readdir_os2_delete_ret;
#define MIN(a,b) ((a)<(b)?(a):(b))
#endif
+#ifdef _WIN32
+#define mkdir(d,m) _mkdir(d)
+#endif
+
static void cleanup(void)
{
/* I'm a lazy bastard */