summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f972da1)
raw | patch | inline | side by side (parent: f972da1)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Thu, 6 Sep 2007 08:42:22 +0000 (08:42 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Thu, 6 Sep 2007 08:42:22 +0000 (08:42 +0000) |
src/rrd_open.c | patch | blob | history |
diff --git a/src/rrd_open.c b/src/rrd_open.c
index c6a2d7d9d49f09a65eaa01f263e23975c97a4064..b9885aa5fc27f0fc543becef760fee7cb41bdcd1 100644 (file)
--- a/src/rrd_open.c
+++ b/src/rrd_open.c
/* write count bytes from buffer buf to the current position
* rrd_file->pos of rrd_file->fd.
- * Returns the number of bytes written. */
+ * Returns the number of bytes written or <0 on error. */
inline ssize_t rrd_write(
rrd_file_t *rrd_file,
size_t count)
{
#ifdef HAVE_MMAP
+ if (count == 0)
+ return 0;
+ if (buf == NULL)
+ return -1 /* EINVAL */
memcpy(rrd_file->file_start + rrd_file->pos, buf, count);
rrd_file->pos += count;
return count; /* mimmic write() semantics */