summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2014-07-05 01:11:28 +0200
committerantirez <antirez@gmail.com>2014-07-05 01:11:28 +0200
commit93cd75bbe084f5d94bbf6216200820ff0b2785fe (patch)
tree580f3752415162c101910da5342c7b0f15290872 /src
parentac33c049c647cbe09b424cff5755504fddc0b4c7 (diff)
downloadredis-93cd75bbe084f5d94bbf6216200820ff0b2785fe.tar.gz
aofChildWriteDiffData() better handling of free blocks.
Diffstat (limited to 'src')
-rw-r--r--src/aof.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/aof.c b/src/aof.c
index 6858120c9..aa97626a1 100644
--- a/src/aof.c
+++ b/src/aof.c
@@ -104,10 +104,13 @@ void aofChildWriteDiffData(aeEventLoop *el, int fd, void *privdata, int mask) {
AE_WRITABLE);
return;
}
- nwritten = write(server.aof_pipe_write_data_to_child,block->buf,block->used);
- if (nwritten <= 0) return;
- memmove(block->buf,block->buf+nwritten,block->used-nwritten);
- block->used -= nwritten;
+ if (block->used > 0) {
+ nwritten = write(server.aof_pipe_write_data_to_child,
+ block->buf,block->used);
+ if (nwritten <= 0) return;
+ memmove(block->buf,block->buf+nwritten,block->used-nwritten);
+ block->used -= nwritten;
+ }
if (block->used == 0) listDelNode(server.aof_rewrite_buf_blocks,ln);
}
}