X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/5b8ce85378f3b0887db254a20d1ae2cb7ad0ad55..cc4c964b33ac108c9541e31eb2e2420addf9a82e:/src/aof.c diff --git a/src/aof.c b/src/aof.c index 0c25cf6c..8ce6cd12 100644 --- a/src/aof.c +++ b/src/aof.c @@ -220,8 +220,10 @@ int loadAppendOnlyFile(char *filename) { int appendonly = server.appendonly; long loops = 0; - if (redis_fstat(fileno(fp),&sb) != -1 && sb.st_size == 0) + if (fp && redis_fstat(fileno(fp),&sb) != -1 && sb.st_size == 0) { + fclose(fp); return REDIS_ERR; + } if (fp == NULL) { redisLog(REDIS_WARNING,"Fatal error: can't open the append log file for reading: %s",strerror(errno)); @@ -529,7 +531,10 @@ int rewriteAppendOnlyFileBackground(void) { pid_t childpid; if (server.bgrewritechildpid != -1) return REDIS_ERR; - redisAssert(server.ds_enabled == 0); + if (server.ds_enabled != 0) { + redisLog(REDIS_WARNING,"BGREWRITEAOF called with diskstore enabled: AOF is not supported when diskstore is enabled. Operation not performed."); + return REDIS_ERR; + } if ((childpid = fork()) == 0) { /* Child */ char tmpfile[256];