From: Tobias Oetiker Date: Mon, 12 Mar 2012 10:47:21 +0000 (+0000) Subject: fix rrdcached crash as reported in debian bug #663505 -- Witold Baryluk X-Git-Tag: 1.4.8~32 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=649d79623f5170f3eab4a397a674600791dc57d4;p=thirdparty%2Frrdtool-1.x.git fix rrdcached crash as reported in debian bug #663505 -- Witold Baryluk git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.4/program@2285 a5681a0c-68f1-0310-ab6d-d61299d08faa --- diff --git a/src/rrd_daemon.c b/src/rrd_daemon.c index 4dfe35c2..f5ab6bbb 100644 --- a/src/rrd_daemon.c +++ b/src/rrd_daemon.c @@ -3093,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)