utils: Set errno to EAGAIN in parse_chunk_header

This commit is contained in:
2026-06-09 16:13:47 +02:00
parent 78ee3dc755
commit 75716075ba
2 changed files with 4 additions and 3 deletions
+1 -1
View File
@@ -430,7 +430,7 @@ long sock_recv_chunk_header(sock *s) {
buf_ptr[ret1] = 0;
if ((ret2 = parse_chunk_header(buf, (buf_ptr - buf) + ret1, &len)) == -1) {
if (errno == EPROTO) {
if (errno != EAGAIN) {
return -1;
} else {
if (sock_recv_x(s, buf_ptr, ret1, 0) == -1)
+3 -2
View File
@@ -424,9 +424,9 @@ long ftelll(FILE *file) {
return lines + 1;
}
long parse_chunk_header(const char *buf, size_t len, size_t *ret_len) {
long parse_chunk_header(const char *buf, const size_t len, size_t *ret_len) {
for (int i = 0; i < len; i++) {
char ch = buf[i];
const char ch = buf[i];
if (ch == '\r') {
continue;
} else if (ch == '\n' && i > 1 && buf[i - 1] == '\r') {
@@ -437,5 +437,6 @@ long parse_chunk_header(const char *buf, size_t len, size_t *ret_len) {
return -1;
}
}
errno = EAGAIN;
return -1;
}