summaryrefslogtreecommitdiff
path: root/gpsd.c
diff options
context:
space:
mode:
authorFred Wright <fw@fwright.net>2017-01-22 01:44:19 -0800
committerFred Wright <fw@fwright.net>2017-01-22 14:02:55 -0800
commit2cb17f91607bdfd9cd7ad80f7232db8b1bd23d34 (patch)
tree452241687896ffdf45d2a002478bf970d67ec7a0 /gpsd.c
parentcb1403d842a2fdbe6109eaf48acb7a494f30784d (diff)
downloadgpsd-2cb17f91607bdfd9cd7ad80f7232db8b1bd23d34.tar.gz
Centralizes daemon() calls.
This defines a new function os_daemon() (in os_compat.c), which is either the old replacement daemon() renamed, or a wrapper around the actual daemon() call. This allows any issues related to daemon() (which exist on some platforms) to be dealt with in one place. No such changes are present yet, so platforms giving warnings for the use of daemon() continue to do so, but now only in the compilation of os_compat.c. Unfortunately, the current build procedure typically compiles os_compat.c multiple times, so the warnings still appear multiple times. TESTED: Ran "scons build-all check" on OSX 10.9, OSX 10.12, Ubuntu 14, and FreeBSD 10.3.
Diffstat (limited to 'gpsd.c')
-rw-r--r--gpsd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gpsd.c b/gpsd.c
index 7aabc269..8aa001d9 100644
--- a/gpsd.c
+++ b/gpsd.c
@@ -10,7 +10,7 @@
/* FreeBSD chokes on this */
/* nice() needs _XOPEN_SOURCE, 500 means X/Open 1995 */
#define _XOPEN_SOURCE 500
-/* setgroups() and daemon() needs _DEFAULT_SOURCE */
+/* setgroups() needs _DEFAULT_SOURCE */
#define _DEFAULT_SOURCE
#endif /* __linux__ */
@@ -1998,7 +1998,7 @@ int main(int argc, char *argv[])
/* might be time to daemonize */
if (go_background) {
/* not SuS/POSIX portable, but we have our own fallback version */
- if (daemon(0, 0) != 0)
+ if (os_daemon(0, 0) != 0)
gpsd_log(&context.errout, LOG_ERROR,
"demonization failed: %s\n",strerror(errno));
}