summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 89048b0)
raw | patch | inline | side by side (parent: 89048b0)
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) |
program/src/rrd_open.c | patch | blob | history |
diff --git a/program/src/rrd_open.c b/program/src/rrd_open.c
index c6a2d7d9d49f09a65eaa01f263e23975c97a4064..b9885aa5fc27f0fc543becef760fee7cb41bdcd1 100644 (file)
--- a/program/src/rrd_open.c
+++ b/program/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 */