From 1056dca533c84e168e69a5af54fc90ba5d718612 Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Sat, 20 Oct 2018 15:45:58 -0400 Subject: Only use pidfile(3) on FreeBSD --- server.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'server.c') diff --git a/server.c b/server.c index 7edf3f2..cff6d21 100644 --- a/server.c +++ b/server.c @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include @@ -34,6 +33,10 @@ #include #include +#ifdef __FreeBSD__ +#include +#endif + #include "torus.h" static struct Tile *tiles; @@ -371,11 +374,13 @@ int main(int argc, char *argv[]) { } } +#ifdef __FreeBSD__ struct pidfh *pid = NULL; if (pidPath) { pid = pidfile_open(pidPath, 0600, NULL); if (!pid) err(EX_CANTCREAT, "%s", pidPath); } +#endif tilesMap(dataPath); @@ -390,11 +395,13 @@ int main(int argc, char *argv[]) { error = bind(server, (struct sockaddr *)&addr, SUN_LEN(&addr)); if (error) err(EX_CANTCREAT, "%s", sockPath); +#ifdef __FreeBSD__ if (pid) { error = daemon(0, 0); if (error) err(EX_OSERR, "daemon"); pidfile_write(pid); } +#endif error = listen(server, 0); if (error) err(EX_OSERR, "listen"); -- cgit 1.4.1