projects
/
rrdtool.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
check permissions before writing to journal -- kevin
[rrdtool.git]
/
src
/
rrd_daemon.c
diff --git
a/src/rrd_daemon.c
b/src/rrd_daemon.c
index
ead969b
..
5163f34
100644
(file)
--- a/
src/rrd_daemon.c
+++ b/
src/rrd_daemon.c
@@
-1339,14
+1339,14
@@
static int handle_request (int fd, socket_privilege privilege, /* {{{ */
if (strcasecmp (command, "update") == 0)
{
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;
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)
return (handle_request_update (fd, buffer_ptr, buffer_size));
}
else if (strcasecmp (command, "wrote") == 0 && fd < 0)
@@
-1999,6
+1999,7
@@
static int daemonize (void) /* {{{ */
{
int status;
int fd;
{
int status;
int fd;
+ char *base_dir;
fd = open_pidfile();
if (fd < 0) return fd;
fd = open_pidfile();
if (fd < 0) return fd;
@@
-2006,7
+2007,6
@@
static int daemonize (void) /* {{{ */
if (!stay_foreground)
{
pid_t child;
if (!stay_foreground)
{
pid_t child;
- char *base_dir;
child = fork ();
if (child < 0)
child = fork ();
if (child < 0)
@@
-2019,17
+2019,6
@@
static int daemonize (void) /* {{{ */
return (1);
}
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 ();
/* Become session leader */
setsid ();
@@
-2043,6
+2032,17
@@
static int daemonize (void) /* {{{ */
dup (0);
} /* if (!stay_foreground) */
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);
install_signal_handlers();
openlog ("rrdcached", LOG_PID, LOG_DAEMON);