This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new c7386775a73 libc/netdb: avoid unnecessary DNS notify if nameserver 
exists
c7386775a73 is described below

commit c7386775a7361380674a130ace6486a776e844bf
Author: daichuan <[email protected]>
AuthorDate: Fri Nov 15 17:18:59 2024 +0800

    libc/netdb: avoid unnecessary DNS notify if nameserver exists
    
    If the nameserver already exists, return directly without calling 
dns_notify_nameserver to prevent cyclic notifications and high CPU usage.
    
    Signed-off-by: daichuan <[email protected]>
---
 libs/libc/netdb/lib_dnsaddserver.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libs/libc/netdb/lib_dnsaddserver.c 
b/libs/libc/netdb/lib_dnsaddserver.c
index b32d17ad4d4..4827ac0aa03 100644
--- a/libs/libc/netdb/lib_dnsaddserver.c
+++ b/libs/libc/netdb/lib_dnsaddserver.c
@@ -227,7 +227,9 @@ int dns_add_nameserver(FAR const struct sockaddr *addr, 
socklen_t addrlen)
           ret = OK;
         }
 
-      goto errout;
+      dns_unlock();
+      fclose(stream);
+      return ret;
     }
 
 #if CONFIG_NETDB_DNSSERVER_NAMESERVERS > 1

Reply via email to