Skip to content

Commit

Permalink
Merge pull request #122 from AnchorCat/ringbuffer
Browse files Browse the repository at this point in the history
Fix a couple of bugs in the ringbuffer code
  • Loading branch information
davidvossel committed Jun 19, 2014
2 parents f8b4a1b + fad9ce0 commit ac7a7ed
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/ringbuffer.c
Expand Up @@ -232,7 +232,7 @@ qb_rb_open_2(const char *name, size_t size, uint32_t flags,
}

qb_util_log(LOG_DEBUG,
"shm size:%zd; real_size:%zd; rb->word_size:%d", size,
"shm size:%ld; real_size:%ld; rb->word_size:%d", size,
real_size, rb->shared_hdr->word_size);

/* this function closes fd_data */
Expand Down Expand Up @@ -886,7 +886,11 @@ qb_rb_create_from_file(int32_t fd, uint32_t flags)
* 6. data
*/
n_required = (word_size * sizeof(uint32_t));
rb = qb_rb_open("create_from_file", n_required,

/*
* qb_rb_open adds QB_RB_CHUNK_MARGIN + 1 to the requested size.
*/
rb = qb_rb_open("create_from_file", n_required - (QB_RB_CHUNK_MARGIN + 1),
QB_RB_FLAG_CREATE | QB_RB_FLAG_NO_SEMAPHORE, 0);
if (rb == NULL) {
return NULL;
Expand Down

0 comments on commit ac7a7ed

Please sign in to comment.