fetch: do not confuse capacity and length

The patch converting fetch to getline
(ee3ca711a8),
did confuse the capacity of the line buffer with the actual len of the read
line confusing fetch -v.
This commit is contained in:
Baptiste Daroussin 2021-09-09 16:48:21 +02:00
parent 187afc5879
commit 635eb7ac79

View File

@ -1526,12 +1526,13 @@ http_get_proxy(struct url * url, const char *flags)
static void
http_print_html(FILE *out, FILE *in)
{
size_t len = 0;
ssize_t len = 0;
size_t cap;
char *line = NULL, *p, *q;
int comment, tag;
comment = tag = 0;
while (getline(&line, &len, in) >= 0) {
while ((len = getline(&line, &cap, in)) >= 0) {
while (len && isspace((unsigned char)line[len - 1]))
--len;
for (p = q = line; q < line + len; ++q) {