BUG/MINOR: buffers: Fix b_slow_realign when a buffer is realign without output

When b_slow_realign is called with the <output> parameter equal to 0, the
buffer's head, after the realign, must be set to 0. It was errornously set to
the buffer's size, because there was no test on the value of <output>.
This commit is contained in:
Christopher Faulet 2018-08-06 15:43:12 +02:00
parent 65e94d1ce9
commit ad4e1a4735

View File

@ -472,7 +472,7 @@ static inline void b_slow_realign(struct buffer *b, char *swap, size_t output)
memcpy(b_orig(b), swap, b_data(b) - output);
memcpy(b_wrap(b) - output, swap + b_size(b) - output, output);
b->head = b_size(b) - output;
b->head = (output ? b_size(b) - output : 0);
}
/* b_putchar() : tries to append char <c> at the end of buffer <b>. Supports