--- embedaddon/libxml2/nanohttp.c 2012/02/21 23:37:57 1.1.1.1 +++ embedaddon/libxml2/nanohttp.c 2013/07/22 01:22:19 1.1.1.2 @@ -64,9 +64,6 @@ #ifdef HAVE_STRINGS_H #include #endif -#ifdef SUPPORT_IP6 -#include -#endif #ifdef HAVE_ZLIB_H #include #endif @@ -1140,10 +1137,12 @@ xmlNanoHTTPConnectHost(const char *host, int port) "Non-recoverable errors: FORMERR, REFUSED, or NOTIMP."; break; +#ifdef NO_ADDRESS case NO_ADDRESS: h_err_txt = "Valid name, no data record of requested type."; break; +#endif default: h_err_txt = "No error text defined."; @@ -1166,7 +1165,7 @@ xmlNanoHTTPConnectHost(const char *host, int port) memcpy (&ia, h->h_addr_list[i], h->h_length); sockin.sin_family = h->h_addrtype; sockin.sin_addr = ia; - sockin.sin_port = (u_short)htons ((unsigned short)port); + sockin.sin_port = (unsigned short)htons ((unsigned short)port); addr = (struct sockaddr *) &sockin; #ifdef SUPPORT_IP6 } else if (have_ipv6 () && (h->h_addrtype == AF_INET6)) { @@ -1615,7 +1614,8 @@ xmlNanoHTTPFetch(const char *URL, const char *filename char *buf = NULL; int fd; int len; - + int ret = 0; + if (filename == NULL) return(-1); ctxt = xmlNanoHTTPOpen(URL, contentType); if (ctxt == NULL) return(-1); @@ -1636,12 +1636,14 @@ xmlNanoHTTPFetch(const char *URL, const char *filename xmlNanoHTTPFetchContent( ctxt, &buf, &len ); if ( len > 0 ) { - write(fd, buf, len); + if (write(fd, buf, len) == -1) { + ret = -1; + } } xmlNanoHTTPClose(ctxt); close(fd); - return(0); + return(ret); } #ifdef LIBXML_OUTPUT_ENABLED @@ -1660,7 +1662,8 @@ xmlNanoHTTPSave(void *ctxt, const char *filename) { char *buf = NULL; int fd; int len; - + int ret = 0; + if ((ctxt == NULL) || (filename == NULL)) return(-1); if (!strcmp(filename, "-")) @@ -1675,12 +1678,14 @@ xmlNanoHTTPSave(void *ctxt, const char *filename) { xmlNanoHTTPFetchContent( ctxt, &buf, &len ); if ( len > 0 ) { - write(fd, buf, len); + if (write(fd, buf, len) == -1) { + ret = -1; + } } xmlNanoHTTPClose(ctxt); close(fd); - return(0); + return(ret); } #endif /* LIBXML_OUTPUT_ENABLED */