]> git.ipfire.org Git - thirdparty/ldns.git/commitdiff
fix for strtol picking up fake parse error from already set errno (on Vista mingw...
authorWouter Wijngaards <wouter@NLnetLabs.nl>
Mon, 24 Nov 2008 14:15:23 +0000 (14:15 +0000)
committerWouter Wijngaards <wouter@NLnetLabs.nl>
Mon, 24 Nov 2008 14:15:23 +0000 (14:15 +0000)
rr.c
str2host.c

diff --git a/rr.c b/rr.c
index 8912cb53276bee0e9f84f4026d975faa14559486..a9f0fa57b8ba70a9bd247cc3e753749190fced82 100644 (file)
--- 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);
index 59fbc0468b3986a5ca89db83665c1d2a3c1f3a0b..e225098167772ed85bab59811d0c62022a2d0973 100644 (file)
@@ -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) {