From: oetiker Date: Tue, 7 Oct 2008 15:38:11 +0000 (+0000) Subject: Daniel Pocock reported that the argument may be NULL in low-diskspace X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=9e9c2f934da8cf7c57f3c3b27fdb02e554e2b032;p=rrdtool.git Daniel Pocock reported that the argument may be NULL in low-diskspace situations, so check for that here to prevent a segmentation fault. -- Florian Forster git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.3/program@1585 a5681a0c-68f1-0310-ab6d-d61299d08faa --- diff --git a/src/rrd_open.c b/src/rrd_open.c index c4ee3c0..06afabe 100644 --- a/src/rrd_open.c +++ b/src/rrd_open.c @@ -364,6 +364,13 @@ void rrd_dontneed( unsigned long i; ssize_t _page_size = sysconf(_SC_PAGESIZE); + if (rrd_file == NULL) { +#if defined DEBUG && DEBUG + fprintf (stderr, "rrd_dontneed: Argument 'rrd_file' is NULL.\n"); +#endif + return; + } + #if defined DEBUG && DEBUG > 1 mincore_print(rrd_file, "before"); #endif