X-Git-Url: https://git.octo.it/?p=rrdtool.git;a=blobdiff_plain;f=src%2Frrd_open.c;h=03cc5b9a1bdf09299d71f60bea509e62da68a97b;hp=dba4ca6fbebbefca9788586786301b104890e1c6;hb=f0a82ae15cafb6ad47ea0c9f74754820e92e2078;hpb=8a092a1ac0d22448114c29c2d872769340965132 diff --git a/src/rrd_open.c b/src/rrd_open.c index dba4ca6..03cc5b9 100644 --- a/src/rrd_open.c +++ b/src/rrd_open.c @@ -6,10 +6,16 @@ * $Id$ *****************************************************************************/ +#ifdef WIN32 #include #include #include +#endif + +#ifdef HAVE_BROKEN_MS_ASYNC +#include #include +#endif #include "rrd_tool.h" #include "unused.h" @@ -210,7 +216,10 @@ rrd_file_t *rrd_open( } else { rrd_file->file_len = newfile_size; lseek(rrd_simple_file->fd, newfile_size - 1, SEEK_SET); - write(rrd_simple_file->fd, "\0", 1); /* poke */ + if ( write(rrd_simple_file->fd, "\0", 1) == -1){ /* poke */ + rrd_set_error("write '%s': %s", file_name, rrd_strerror(errno)); + goto out_close; + } lseek(rrd_simple_file->fd, 0, SEEK_SET); } #ifdef HAVE_POSIX_FADVISE @@ -253,12 +262,14 @@ rrd_file_t *rrd_open( #ifdef USE_MADVISE if (rdwr & RRD_COPY) { /* We will read everything in a moment (copying) */ - madvise(data, rrd_file->file_len, MADV_WILLNEED | MADV_SEQUENTIAL); + madvise(data, rrd_file->file_len, MADV_WILLNEED ); + madvise(data, rrd_file->file_len, MADV_SEQUENTIAL ); } else { /* We do not need to read anything in for the moment */ madvise(data, rrd_file->file_len, MADV_RANDOM); /* the stat_head will be needed soonish, so hint accordingly */ - madvise(data, sizeof(stat_head_t), MADV_WILLNEED | MADV_RANDOM); + madvise(data, sizeof(stat_head_t), MADV_WILLNEED); + madvise(data, sizeof(stat_head_t), MADV_RANDOM); } #endif @@ -669,6 +680,13 @@ ssize_t rrd_write( } +/* this is a leftover from the old days, it serves no purpose + and is therefore turned into a no-op */ +void rrd_flush( + rrd_file_t *rrd_file __attribute__((unused))) +{ +} + /* Initialize RRD header. */ void rrd_init(