From 83bc01436eebc00fb646e1e494f3e42b46d5335b Mon Sep 17 00:00:00 2001 From: Arthur de Jong Date: Wed, 23 Mar 2011 21:28:28 +0000 Subject: provide a definition of daemon() for systems that lack it git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd@1403 ef36b2f9-881f-0410-afb5-c4e39611909c --- compat/daemon.h | 9 ++++++--- configure.ac | 1 + nslcd/nslcd.c | 2 -- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/compat/daemon.h b/compat/daemon.h index 8d10514..5a2b02a 100644 --- a/compat/daemon.h +++ b/compat/daemon.h @@ -1,7 +1,7 @@ /* daemon.h - definition of daemon() for systems that lack it - Copyright (C) 2002, 2003, 2008 Arthur de Jong + Copyright (C) 2002, 2003, 2008, 2011 Arthur de Jong This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -24,8 +24,11 @@ #include -/* deamonize process, optionally chdir to / and optionally close stdin, - strdout and stderr and redirect them to /dev/null */ +#if !HAVE_DECL_DAEMON +/* we define daemon() here because on some platforms the function is + undefined: deamonize process, optionally chdir to / and optionally + close stdin, strdout and stderr and redirect them to /dev/null */ int daemon(int nochdir,int noclose); +#endif /* not HAVE_DECL_DAEMON */ #endif /* not COMPAT__DAEMON_H */ diff --git a/configure.ac b/configure.ac index 2a0cede..ba4b3bf 100644 --- a/configure.ac +++ b/configure.ac @@ -570,6 +570,7 @@ then # replace daemon() function if it is not on the system AC_SEARCH_LIBS(daemon,bsd) AC_REPLACE_FUNCS(daemon) + AC_CHECK_DECLS([daemon],,,[#include ]) # replace ether_aton_r() and ether_ntoa_r() if they are not found AC_CHECK_FUNCS(ether_aton_r ether_ntoa_r,,[AC_LIBOBJ(ether)]) diff --git a/nslcd/nslcd.c b/nslcd/nslcd.c index 4d4e70b..d67951b 100644 --- a/nslcd/nslcd.c +++ b/nslcd/nslcd.c @@ -52,9 +52,7 @@ #ifndef HAVE_GETOPT_LONG #include "compat/getopt_long.h" #endif /* not HAVE_GETOPT_LONG */ -#ifndef HAVE_DAEMON #include "compat/daemon.h" -#endif /* not HAVE_DAEMON */ #include #include -- cgit v1.2.3