Skip to content

Commit 49cdb0b

Browse files
authored
Merge pull request #5945 from kjbracey-arm/dns_multiple
Correct return value of nsapi_dns_query_multiple
2 parents ebc8adb + 15a3922 commit 49cdb0b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

features/netsocket/nsapi_dns.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ static nsapi_size_or_error_t nsapi_dns_query_multiple(NetworkStack *stack, const
214214
socket.set_timeout(DNS_TIMEOUT);
215215

216216
// create network packet
217-
uint8_t *packet = (uint8_t *)malloc(DNS_BUFFER_SIZE);
217+
uint8_t * const packet = (uint8_t *)malloc(DNS_BUFFER_SIZE);
218218
if (!packet) {
219219
return NSAPI_ERROR_NO_MEMORY;
220220
}
@@ -243,8 +243,9 @@ static nsapi_size_or_error_t nsapi_dns_query_multiple(NetworkStack *stack, const
243243
}
244244

245245
const uint8_t *response = packet;
246-
if (dns_scan_response(&response, addr, addr_count) > 0) {
247-
result = NSAPI_ERROR_OK;
246+
int count = dns_scan_response(&response, addr, addr_count);
247+
if (count > 0) {
248+
result = count;
248249
}
249250

250251
/* The DNS response is final, no need to check other servers */

0 commit comments

Comments
 (0)