@ -27,7 +27,10 @@ ssize_t buffer_seek(buffer* b,size_t len) {
ssize_t r = buffer_feed(b);
if (r < 0) return -1;
if (r == 0) break;
if ((size_t)r > len) r = len; // can't happen
if ((size_t)r > len) { // awesome, we are done
b->p = len;
return r;
}
len -= r;
b->p = b->n = 0;