summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: fa8321e)
raw | patch | inline | side by side (parent: fa8321e)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Tue, 30 Sep 2008 18:42:34 +0000 (18:42 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Tue, 30 Sep 2008 18:42:34 +0000 (18:42 +0000) |
-- kevin
git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1549 a5681a0c-68f1-0310-ab6d-d61299d08faa
git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1549 a5681a0c-68f1-0310-ab6d-d61299d08faa
src/rrd_daemon.c | patch | blob | history |
diff --git a/src/rrd_daemon.c b/src/rrd_daemon.c
index ead969b4a7a5e8984512e79a7a691c5e41e8b4a4..a0e6bdbf9f629d62e8408548cffd39edc9843154 100644 (file)
--- a/src/rrd_daemon.c
+++ b/src/rrd_daemon.c
{
int status;
int fd;
+ char *base_dir;
fd = open_pidfile();
if (fd < 0) return fd;
if (!stay_foreground)
{
pid_t child;
- char *base_dir;
child = fork ();
if (child < 0)
return (1);
}
- /* Change into the /tmp directory. */
- base_dir = (config_base_dir != NULL)
- ? config_base_dir
- : "/tmp";
- status = chdir (base_dir);
- if (status != 0)
- {
- fprintf (stderr, "daemonize: chdir (%s) failed.\n", base_dir);
- return (-1);
- }
-
/* Become session leader */
setsid ();
dup (0);
} /* if (!stay_foreground) */
+ /* Change into the /tmp directory. */
+ base_dir = (config_base_dir != NULL)
+ ? config_base_dir
+ : "/tmp";
+ status = chdir (base_dir);
+ if (status != 0)
+ {
+ fprintf (stderr, "daemonize: chdir (%s) failed.\n", base_dir);
+ return (-1);
+ }
+
install_signal_handlers();
openlog ("rrdcached", LOG_PID, LOG_DAEMON);