X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Frrd_daemon.c;h=710fa017d747210882aeba6e9ecdba188b93c933;hb=0a44f03f42eefa9c7a870a27d7160e2a6be22537;hp=b4bc1ee06ef0319ce83eb79797857ea88de4f0c7;hpb=45fb79dd5d7871bc7a80821ad198bc70d43fdf2e;p=rrdtool.git diff --git a/src/rrd_daemon.c b/src/rrd_daemon.c index b4bc1ee..710fa01 100644 --- a/src/rrd_daemon.c +++ b/src/rrd_daemon.c @@ -77,11 +77,13 @@ #include #ifndef WIN32 -#include +#ifdef HAVE_STDINT_H +# include +#endif #include #include #include -# include +#include #else @@ -2675,7 +2677,6 @@ static int cleanup (void) /* {{{ */ free(queue_threads); free(config_base_dir); - free(config_pid_file); pthread_mutex_lock(&cache_lock); g_tree_destroy(cache_tree); @@ -2687,6 +2688,7 @@ static int cleanup (void) /* {{{ */ closelog (); remove_pidfile (); + free(config_pid_file); return (0); } /* }}} int cleanup */ @@ -2921,18 +2923,17 @@ static int read_options (int argc, char **argv) /* {{{ */ case 'j': { - struct stat statbuf; const char *dir = journal_dir = strdup(optarg); - status = stat(dir, &statbuf); + status = rrd_mkdir_p(dir, 0777); if (status != 0) { - fprintf(stderr, "Cannot stat '%s' : %s\n", dir, rrd_strerror(errno)); + fprintf(stderr, "Failed to create journal directory '%s': %s\n", + dir, rrd_strerror(errno)); return 6; } - if (!S_ISDIR(statbuf.st_mode) - || access(dir, R_OK|W_OK|X_OK) != 0) + if (access(dir, R_OK|W_OK|X_OK) != 0) { fprintf(stderr, "Must specify a writable directory with -j! (%s)\n", errno ? rrd_strerror(errno) : "");