X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Fdaemon.c;h=f9d663aef228ae0ae520da780134aee654e97bf5;hp=a3a6ab12a0c31b9e9ee6096794f4d7176ca90190;hb=2dbe1df5facb92bac31b5da0ca2e2e8ee6f9b358;hpb=b2e784850fc85ca61e06610756ebc54b19c59895 diff --git a/src/daemon.c b/src/daemon.c index a3a6ab1..f9d663a 100644 --- a/src/daemon.c +++ b/src/daemon.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2008, Index Data ApS * See the file LICENSE for details. * - * $Id: daemon.c,v 1.1 2008-02-18 17:07:06 adam Exp $ + * $Id: daemon.c,v 1.2 2008-02-21 10:15:30 adam Exp $ */ /** @@ -17,20 +17,32 @@ #include #include #include +#if HAVE_UNISTD_H #include -#include +#endif #include #include +#if HAVE_SYS_WAIT_H #include +#endif + #include + +#if HAVE_SYS_STAT_H #include +#endif + #include + +#if HAVE_PWD_H #include +#endif #include #include #include +#if HAVE_PWD_H static void write_pidfile(int pid_fd) { if (pid_fd != -1) @@ -148,12 +160,14 @@ static void keepalive(void (*work)(void *data), void *data) run++; } } +#endif int yaz_daemon(const char *progname, unsigned int flags, void (*work)(void *data), void *data, const char *pidfile, const char *uid) { +#if HAVE_PWD_H int pid_fd = -1; /* open pidfile .. defer write until in child and after setuid */ @@ -249,6 +263,10 @@ int yaz_daemon(const char *progname, work(data); } return 0; +#else + work(data); + return 0; +#endif } /*