The previous code was incorrectly clearing errno after calling
strtol but before testing the result rather than clearing it and
then calling strtol so that changes to errno can be correctly
determined.
(cherry picked from commit
d3ffa1f0073899a96e478906fff5af31eba33784)
if (name_match(header, "Content-Length")) {
char *endptr;
- long val = strtol(header->value, &endptr, 10);
-
errno = 0;
+ long val = strtol(header->value, &endptr, 10);
/* ensure we consumed all digits */
if ((header->value + header->value_len) != endptr) {