From: antirez Date: Thu, 1 Jul 2010 18:13:33 +0000 (+0200) Subject: fixed error code checking for *write operations and return value in AOF rewriting... X-Git-Url: https://git.saurik.com/redis.git/commitdiff_plain/daf2049d0d62aa2b77bd6f9a38d03bb4bbfed59c fixed error code checking for *write operations and return value in AOF rewriting function --- diff --git a/src/aof.c b/src/aof.c index 51054b29..ce177c8c 100644 --- a/src/aof.c +++ b/src/aof.c @@ -500,9 +500,9 @@ int rewriteAppendOnlyFile(char *filename) { while((p = zipmapNext(p,&field,&flen,&val,&vlen)) != NULL) { if (fwrite(cmd,sizeof(cmd)-1,1,fp) == 0) goto werr; if (fwriteBulkObject(fp,&key) == 0) goto werr; - if (fwriteBulkString(fp,(char*)field,flen) == -1) + if (fwriteBulkString(fp,(char*)field,flen) == 0) return -1; - if (fwriteBulkString(fp,(char*)val,vlen) == -1) + if (fwriteBulkString(fp,(char*)val,vlen) == 0) return -1; } } else { @@ -515,8 +515,8 @@ int rewriteAppendOnlyFile(char *filename) { if (fwrite(cmd,sizeof(cmd)-1,1,fp) == 0) goto werr; if (fwriteBulkObject(fp,&key) == 0) goto werr; - if (fwriteBulkObject(fp,field) == -1) return -1; - if (fwriteBulkObject(fp,val) == -1) return -1; + if (fwriteBulkObject(fp,field) == -1) return REDIS_ERR; + if (fwriteBulkObject(fp,val) == -1) return REDIS_ERR; } dictReleaseIterator(di); }