diff --git a/src/rrd_daemon.c b/src/rrd_daemon.c
index 17153ce98be3309f985b885b486e3a0fc7b5fd6d..ed7bb4de9f9f59ae52b49245f12ae6056026ebd3 100644 (file)
--- a/src/rrd_daemon.c
+++ b/src/rrd_daemon.c
#include <tcpd.h>
#endif /* HAVE_LIBWRAP */
-#include <glib-2.0/glib.h>
+#include <glib.h>
/* }}} */
#define RRDD_LOG(severity, ...) \
static void sig_common (const char *sig) /* {{{ */
{
RRDD_LOG(LOG_NOTICE, "caught SIG%s", sig);
- state = FLUSHING;
+ if (state == RUNNING) {
+ state = FLUSHING;
+ }
pthread_cond_broadcast(&flush_cond);
pthread_cond_broadcast(&queue_cond);
} /* }}} void sig_common */
{
char journal_dir_actual[PATH_MAX];
const char *dir;
- dir = journal_dir = strdup(realpath((const char *)optarg, journal_dir_actual));
+ if (realpath((const char *)optarg, journal_dir_actual) == NULL)
+ {
+ fprintf(stderr, "Failed to canonicalize the journal directory '%s': %s\n",
+ optarg, rrd_strerror(errno));
+ return 7;
+ }
+ dir = journal_dir = strdup(journal_dir_actual);
+ if (dir == NULL) {
+ fprintf (stderr, "read_options: strdup failed.\n");
+ return (3);
+ }
status = rrd_mkdir_p(dir, 0777);
if (status != 0)