Permalink
Browse files

bugfix: read 0

  • Loading branch information...
cloudwu committed Jul 31, 2012
1 parent 9f31245 commit f2c09a433c0b8d27b35b4104959c43042aca8eda
Showing with 5 additions and 1 deletion.
  1. +5 −1 ringbuffer.c
View
@@ -190,7 +190,11 @@ ringbuffer_data(struct ringbuffer * rb, struct ringbuffer_block * blk, int size,
}
return ret;
}
- assert(blk->next >= 0);
+ if (blk->next < 0) {
+ assert(length == skip);
+ *ptr = NULL;
+ return 0;
+ }
blk = block_ptr(rb, blk->next);
assert(blk->offset == 0);
skip -= length;

0 comments on commit f2c09a4

Please sign in to comment.