diff options
-rw-r--r-- | configure.ac | 21 | ||||
-rw-r--r-- | libdaemon/dfork.c | 4 | ||||
-rw-r--r-- | libdaemon/dpid.c | 1 |
3 files changed, 23 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac index 66ed2a6..b7ff615 100644 --- a/configure.ac +++ b/configure.ac @@ -42,8 +42,27 @@ AC_PROG_LIBTOOL() if test "x$GCC" = "xyes" ; then CFLAGS="$CFLAGS -pipe -W -Wall -pedantic" + # Test whether sys/signal.h can be included when compiled with -std=c99 + AC_MSG_CHECKING([checking whether sys/signal.h can be included with -std=c99]) + OLDCFLAGS="$CFLAGS" + CFLAGS="-std=c99" + AC_TRY_COMPILE([#include <sys/signal.h>], + [int main(void) { + struct sigaction sa; + sa.sa_handler = 0; + return 0; + };], use_stdc99=yes, use_stdc99=no) + + if test x"$use_stdc99" = xyes; then + CFLAGS="-std=c99 $OLDCFLAGS" + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + CFLAGS="$OLDCFLAGS" + fi + AC_LANG_CONFTEST([int main() {}]) - $CC -c conftest.c -std=c99 -Wno-unused-parameter $CFLAGS > /dev/null 2> /dev/null && CFLAGS="$CFLAGS -std=c99 -Wno-unused-parameter" + $CC -c conftest.c -Wno-unused-parameter $CFLAGS > /dev/null 2> /dev/null && CFLAGS="$CFLAGS -Wno-unused-parameter" rm -f conftest.o fi diff --git a/libdaemon/dfork.c b/libdaemon/dfork.c index 263c6f5..19e02a0 100644 --- a/libdaemon/dfork.c +++ b/libdaemon/dfork.c @@ -210,12 +210,12 @@ pid_t daemon_fork(void) { setsid(); setpgid(0,0); - +#ifdef TIOCNOTTY if ((tty_fd = open("/dev/tty", O_RDWR)) >= 0) { ioctl(tty_fd, TIOCNOTTY, NULL); close(tty_fd); } - +#endif dpid = getpid(); if (atomic_write(pipe_fds[1], &dpid, sizeof(dpid)) != sizeof(dpid)) goto fail; diff --git a/libdaemon/dpid.c b/libdaemon/dpid.c index c01ed0a..b2e113c 100644 --- a/libdaemon/dpid.c +++ b/libdaemon/dpid.c @@ -32,6 +32,7 @@ #include <sys/types.h> #include <sys/stat.h> #include <time.h> +#include <sys/select.h> #include <fcntl.h> #include <stddef.h> |