diff --git a/src/aof.c b/src/aof.c index dbe7bfa6d..236a98c48 100644 --- a/src/aof.c +++ b/src/aof.c @@ -969,9 +969,9 @@ int rewriteAppendOnlyFile(char *filename) { } /* Make sure data will not remain on the OS's output buffers */ - fflush(fp); - aof_fsync(fileno(fp)); - fclose(fp); + if (fflush(fp) == EOF) goto werr; + if (aof_fsync(fileno(fp)) == -1) goto werr; + if (fclose(fp) == EOF) goto werr; /* Use RENAME to make sure the DB file is changed atomically only * if the generate DB file is ok. */ diff --git a/src/rdb.c b/src/rdb.c index 1a472dbc7..eb27bfa7a 100644 --- a/src/rdb.c +++ b/src/rdb.c @@ -690,9 +690,9 @@ int rdbSave(char *filename) { rioWrite(&rdb,&cksum,8); /* Make sure data will not remain on the OS's output buffers */ - fflush(fp); - fsync(fileno(fp)); - fclose(fp); + if (fflush(fp) == EOF) goto werr; + if (fsync(fileno(fp)) == -1) goto werr; + if (fclose(fp) == EOF) goto werr; /* Use RENAME to make sure the DB file is changed atomically only * if the generate DB file is ok. */