summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c1eb131)
raw | patch | inline | side by side (parent: c1eb131)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Thu, 6 Sep 2007 08:40:36 +0000 (08:40 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Thu, 6 Sep 2007 08:40:36 +0000 (08:40 +0000) |
-- Bernhard Fischer
git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk@1197 a5681a0c-68f1-0310-ab6d-d61299d08faa
git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk@1197 a5681a0c-68f1-0310-ab6d-d61299d08faa
program/src/rrd_open.c | patch | blob | history |
diff --git a/program/src/rrd_open.c b/program/src/rrd_open.c
index 0774bced2996703eb5b80d4ee7dab9ba343b68ff..c6a2d7d9d49f09a65eaa01f263e23975c97a4064 100644 (file)
--- a/program/src/rrd_open.c
+++ b/program/src/rrd_open.c
{
#ifdef HAVE_MMAP
size_t _cnt = count;
- ssize_t _surplus = rrd_file->pos + _cnt - rrd_file->file_len;
+ ssize_t _surplus;
+ if (rrd_file->pos > rrd_file->file_len || _cnt == 0) /* EOF */
+ return 0;
+ if (buf == NULL)
+ return -1; /* EINVAL */
+ _surplus = rrd_file->pos + _cnt - rrd_file->file_len;
if (_surplus > 0) { /* short read */
_cnt -= _surplus;
}