From 8ec0b3bf999cad58f8cc33e0fb37dcf7063e4a61 Mon Sep 17 00:00:00 2001 From: oetiker Date: Sun, 7 Jun 2009 14:27:52 +0000 Subject: [PATCH] check return value from write git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1851 a5681a0c-68f1-0310-ab6d-d61299d08faa --- src/rrd_open.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/rrd_open.c b/src/rrd_open.c index d09f640..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 -- 2.11.0