Commit daf2049d authored by antirez's avatar antirez
Browse files

fixed error code checking for *write operations and return value in AOF rewriting function

parent af4e866d
...@@ -500,9 +500,9 @@ int rewriteAppendOnlyFile(char *filename) { ...@@ -500,9 +500,9 @@ int rewriteAppendOnlyFile(char *filename) {
while((p = zipmapNext(p,&field,&flen,&val,&vlen)) != NULL) { while((p = zipmapNext(p,&field,&flen,&val,&vlen)) != NULL) {
if (fwrite(cmd,sizeof(cmd)-1,1,fp) == 0) goto werr; if (fwrite(cmd,sizeof(cmd)-1,1,fp) == 0) goto werr;
if (fwriteBulkObject(fp,&key) == 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; return -1;
if (fwriteBulkString(fp,(char*)val,vlen) == -1) if (fwriteBulkString(fp,(char*)val,vlen) == 0)
return -1; return -1;
} }
} else { } else {
...@@ -515,8 +515,8 @@ int rewriteAppendOnlyFile(char *filename) { ...@@ -515,8 +515,8 @@ int rewriteAppendOnlyFile(char *filename) {
if (fwrite(cmd,sizeof(cmd)-1,1,fp) == 0) goto werr; if (fwrite(cmd,sizeof(cmd)-1,1,fp) == 0) goto werr;
if (fwriteBulkObject(fp,&key) == 0) goto werr; if (fwriteBulkObject(fp,&key) == 0) goto werr;
if (fwriteBulkObject(fp,field) == -1) return -1; if (fwriteBulkObject(fp,field) == -1) return REDIS_ERR;
if (fwriteBulkObject(fp,val) == -1) return -1; if (fwriteBulkObject(fp,val) == -1) return REDIS_ERR;
} }
dictReleaseIterator(di); dictReleaseIterator(di);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment