From: Simon Ruderich Date: Mon, 3 Jun 2013 19:59:57 +0000 (+0200) Subject: Only hook vfork() if it's available. X-Git-Tag: 0.1~118 X-Git-Url: https://ruderich.org/simon/gitweb/?p=coloredstderr%2Fcoloredstderr.git;a=commitdiff_plain;h=7c5d6fce3a6f52243948e3eae452acb968d78469 Only hook vfork() if it's available. --- 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