From d2cce3f3bbb3084444adef6930a9b0dad6239427 Mon Sep 17 00:00:00 2001 From: Nicolas Pennequin Date: Fri, 3 Aug 2007 19:14:28 +0200 Subject: [PATCH] Write to the handle's current position and not the buffer writing position. Shouldn't change anything now but will prevent potential bugs. --- testplugin.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/testplugin.c b/testplugin.c index 871a470..d7b6550 100644 --- a/testplugin.c +++ b/testplugin.c @@ -293,14 +293,14 @@ static ssize_t buffer_handle(int handle_id) //DEBUGF("h: %d\n", (void *)h - (void *)buffer); //DEBUGF("buf_widx: %ld\n", (long)buf_widx); /* max amount to copy */ - size_t copy_n = MIN(conf_filechunk, buffer_len - buf_widx); + size_t copy_n = MIN(conf_filechunk, buffer_len - h->widx); /* stop copying if it would overwrite the reading position */ - if (RINGBUF_ADD_CROSS(buf_widx, copy_n, buf_ridx) >= 0) + if (RINGBUF_ADD_CROSS(h->widx, copy_n, buf_ridx) >= 0) break; /* rc is the actual amount read */ - int rc = rb->read(h->fd, &buffer[buf_widx], copy_n); + int rc = rb->read(h->fd, &buffer[h->widx], copy_n); if (rc < 0) { -- 2.11.4.GIT