--- libmemcache-1.0.2/memcache.c 2004-12-08 00:25:19.000000000 +0000 +++ memcache.c 2004-12-08 23:24:02.000000000 +0000 @@ -801,7 +801,7 @@ mc_get_line(struct memcache *mc, struct if (ret == -1) errx(EX_OSERR, "%s:%u\tselect()", __FILE__, __LINE__); #endif - rb = read(ms->fd, mc->read_cur, mc->size - (size_t)(mc->cur - mc->buf)); + rb = read(ms->fd, mc->read_cur, mc->size - (size_t)(mc->read_cur - mc->buf)); switch(rb) { case -1: /* We're in non-blocking mode, don't abort because of EAGAIN or @@ -823,7 +823,7 @@ mc_get_line(struct memcache *mc, struct * being that we double our buffer and read(2) returns zero new * bytes. If people are hitting this case a lot, * GET_INIT_BUF_SIZE should be increased. */ - if (rb == mc->size - (size_t)(mc->cur - mc->buf)) { + if (rb == mc->size - (size_t)(mc->read_cur - mc->buf)) { goto get_more_bits; }