if (strcasecmp (command, "update") == 0)
{
- /* don't re-write updates in replay mode */
- if (fd >= 0)
- journal_write(command, buffer_ptr);
-
status = has_privilege(privilege, PRIV_HIGH, fd);
if (status <= 0)
return status;
+ /* don't re-write updates in replay mode */
+ if (fd >= 0)
+ journal_write(command, buffer_ptr);
+
return (handle_request_update (fd, buffer_ptr, buffer_size));
}
else if (strcasecmp (command, "wrote") == 0 && fd < 0)
{
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);