X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Frrd_daemon.c;h=ed7bb4de9f9f59ae52b49245f12ae6056026ebd3;hb=d9822df7ed5e8122cf3a62e4e99678e94007f504;hp=17153ce98be3309f985b885b486e3a0fc7b5fd6d;hpb=9f0813b4758a59be4d061e12efd7236bccfe7ac3;p=pkg-rrdtool.git diff --git a/src/rrd_daemon.c b/src/rrd_daemon.c index 17153ce..ed7bb4d 100644 --- a/src/rrd_daemon.c +++ b/src/rrd_daemon.c @@ -105,7 +105,7 @@ #include #endif /* HAVE_LIBWRAP */ -#include +#include /* }}} */ #define RRDD_LOG(severity, ...) \ @@ -292,7 +292,9 @@ static int handle_request_help (HANDLER_PROTO); 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 */ @@ -3091,7 +3093,17 @@ static int read_options (int argc, char **argv) /* {{{ */ { 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)