From c7543ab6f1ae4e4a3defafeecfd4cb2d7198a6c1 Mon Sep 17 00:00:00 2001 From: antirez Date: Thu, 1 Jul 2010 20:15:44 +0200 Subject: [PATCH] fixed error code checking for *write operations and return value in AOF rewriting function --- redis.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/redis.c b/redis.c index 4b6cea24..2ef45ae9 100644 --- a/redis.c +++ b/redis.c @@ -8618,10 +8618,10 @@ static 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) - return -1; - if (fwriteBulkString(fp,(char*)val,vlen) == -1) - return -1; + if (fwriteBulkString(fp,(char*)field,flen) == 0) + goto werr; + if (fwriteBulkString(fp,(char*)val,vlen) == 0) + goto werr; } } else { dictIterator *di = dictGetIterator(o->ptr); @@ -8633,8 +8633,8 @@ static 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) == 0) goto werr; + if (fwriteBulkObject(fp,val) == 0) goto werr; } dictReleaseIterator(di); }