From 7c5d6fce3a6f52243948e3eae452acb968d78469 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Mon, 3 Jun 2013 21:59:57 +0200 Subject: [PATCH] Only hook vfork() if it's available. --- configure.ac | 2 ++ src/coloredstderr.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/configure.ac b/configure.ac index 6064f08..79a99f5 100644 --- a/configure.ac +++ b/configure.ac @@ -37,9 +37,11 @@ AC_C_INLINE AC_CHECK_HEADERS([fcntl.h]) +AC_TYPE_PID_T AC_TYPE_SIZE_T AC_TYPE_SSIZE_T +AC_FUNC_FORK AC_FUNC_MALLOC AC_FUNC_REALLOC AC_CHECK_FUNCS([dup2 memmove setenv strdup]) diff --git a/src/coloredstderr.c b/src/coloredstderr.c index 9ade423..c152218 100644 --- a/src/coloredstderr.c +++ b/src/coloredstderr.c @@ -330,6 +330,7 @@ int fclose(FILE *fp) { /* Hook functions which are necessary for correct tracking. */ +#if defined(HAVE_VFORK) && defined(HAVE_FORK) pid_t vfork(void) { /* vfork() is similar to fork() but the address space is shared between * father and child. It's designed for fork()/exec() usage because it's @@ -344,3 +345,4 @@ pid_t vfork(void) { * most systems use copy-on-write anyway not a performance issue. */ return fork(); } +#endif -- 2.45.2