X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Frrd_open.c;h=03cc5b9a1bdf09299d71f60bea509e62da68a97b;hb=95df04d6dd28f811004faf0cd000e7f0e82beba7;hp=062de236b0b41c77674dd8fabc202e48e8482c50;hpb=896f660d222db6362e6171c68d33e8eecdc0d57a;p=rrdtool.git diff --git a/src/rrd_open.c b/src/rrd_open.c index 062de23..03cc5b9 100644 --- a/src/rrd_open.c +++ b/src/rrd_open.c @@ -216,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 @@ -259,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 @@ -675,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(