From: oetiker Date: Mon, 28 Sep 2009 16:15:13 +0000 (+0000) Subject: try to create missing journal directories rather than abort with an error. -- Sebasti... X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=7339e36323bf1e6954be28e317b7ca0db8e56def;p=rrdtool.git try to create missing journal directories rather than abort with an error. -- Sebastian Harl git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1914 a5681a0c-68f1-0310-ab6d-d61299d08faa --- diff --git a/src/rrd_daemon.c b/src/rrd_daemon.c index 16b5df5..308d3b6 100644 --- a/src/rrd_daemon.c +++ b/src/rrd_daemon.c @@ -2923,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) : "");