From: Wouter Wijngaards Date: Mon, 24 Nov 2008 14:15:23 +0000 (+0000) Subject: fix for strtol picking up fake parse error from already set errno (on Vista mingw... X-Git-Tag: release-1.4.1~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e796ad283955d2a090fa0677bff24c2f53d63cdc;p=thirdparty%2Fldns.git fix for strtol picking up fake parse error from already set errno (on Vista mingw). By the way, we have a couple strtol(.., .., 0) calls, shouldn't those be base 10, Jelte? --- diff --git a/rr.c b/rr.c index 8912cb53..a9f0fa57 100644 --- a/rr.c +++ b/rr.c @@ -397,7 +397,7 @@ ldns_rr_new_frm_str_internal(ldns_rr **newrr, const char *str, * it does specify size though... */ rd_strlen = strlen(rd); - + /* unknown RR data */ if (rd_strlen == 2 && strncmp(rd, "\\#", 2) == 0 && !quoted) { c = ldns_bget_token(rd_buf, rd, delimiters, LDNS_MAX_RDFLEN); diff --git a/str2host.c b/str2host.c index 59fbc046..e2250981 100644 --- a/str2host.c +++ b/str2host.c @@ -185,6 +185,8 @@ ldns_str2rdf_int32(ldns_rdf **rd, const char *longstr) uint32_t l; r = (uint16_t*)LDNS_MALLOC(uint32_t); + errno = 0; /* must set to zero before call, + note race condition on errno */ l = htonl((uint32_t)strtol((char*)longstr, &end, 0)); if(*end != 0) {