From fa092c47c81250db6f15019aa91d90bf51148386 Mon Sep 17 00:00:00 2001 From: goldsimon Date: Sat, 20 Nov 2010 16:40:35 +0000 Subject: [PATCH] Fixed bug #31701: Error return value from dns_gethostbyname() does not match documentation: return ERR_ARG instead of ERR_VAL if not initialized or wrong argument. --- CHANGELOG | 5 +++++ src/core/dns.c | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 7be2d2ae..e74c8f88 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -229,6 +229,11 @@ HISTORY ++ Bugfixes: + 2010-11-20: Simon Goldschmidt + * dns.c: Fixed bug #31701: Error return value from dns_gethostbyname() does + not match documentation: return ERR_ARG instead of ERR_VAL if not + initialized or wrong argument. + 2010-10-20: Simon Goldschmidt * sockets.h: Fixed bug #31385: sizeof(struct sockaddr) is 30 but should be 16 diff --git a/src/core/dns.c b/src/core/dns.c index 2efc4517..d6336122 100644 --- a/src/core/dns.c +++ b/src/core/dns.c @@ -922,6 +922,7 @@ dns_enqueue(const char *name, dns_found_callback found, void *callback_arg) * name is already in the local names table. * - ERR_INPROGRESS enqueue a request to be sent to the DNS server * for resolution if no errors are present. + * - ERR_ARG: dns client not initialized or invalid hostname * * @param hostname the hostname that is to be queried * @param addr pointer to a ip_addr_t where to store the address if it is already @@ -941,7 +942,7 @@ dns_gethostbyname(const char *hostname, ip_addr_t *addr, dns_found_callback foun if ((dns_pcb == NULL) || (addr == NULL) || (!hostname) || (!hostname[0]) || (strlen(hostname) >= DNS_MAX_NAME_LENGTH)) { - return ERR_VAL; + return ERR_ARG; } #if LWIP_HAVE_LOOPIF