[rtems-lwip commit] lwip: Provide h_errno

Joel Sherrill joel at rtems.org
Thu Sep 29 12:30:14 UTC 2022


Module:    rtems-lwip
Branch:    master
Commit:    e05676b468a7921b607a856730f650c59721763c
Changeset: http://git.rtems.org/rtems-lwip/commit/?id=e05676b468a7921b607a856730f650c59721763c

Author:    Kinsey Moore <kinsey.moore at oarcorp.com>
Date:      Thu Sep  8 08:02:14 2022 -0500

lwip: Provide h_errno

Any application using gethostbyname requires h_errno. This restores the
ability to link applications that make use of h_errno by way of
gethostbyname.

---

 lwip/src/api/netdb.c          | 3 +++
 lwip/src/include/lwip/netdb.h | 6 +++---
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/lwip/src/api/netdb.c b/lwip/src/api/netdb.c
index ee78297..6592728 100644
--- a/lwip/src/api/netdb.c
+++ b/lwip/src/api/netdb.c
@@ -58,6 +58,9 @@ struct gethostbyname_r_helper {
 
 /** h_errno is exported in netdb.h for access by applications. */
 #if LWIP_DNS_API_DECLARE_H_ERRNO
+#ifdef __rtems__
+#undef h_errno
+#endif
 int h_errno;
 #endif /* LWIP_DNS_API_DECLARE_H_ERRNO */
 
diff --git a/lwip/src/include/lwip/netdb.h b/lwip/src/include/lwip/netdb.h
index eaae285..03186fe 100644
--- a/lwip/src/include/lwip/netdb.h
+++ b/lwip/src/include/lwip/netdb.h
@@ -46,14 +46,14 @@
 extern "C" {
 #endif
 
-#ifdef __rtems__
-#include <netdb.h>
-#else
 /* some rarely used options */
 #ifndef LWIP_DNS_API_DECLARE_H_ERRNO
 #define LWIP_DNS_API_DECLARE_H_ERRNO  1
 #endif
 
+#ifdef __rtems__
+#include <netdb.h>
+#else
 #ifndef LWIP_DNS_API_DEFINE_ERRORS
 #define LWIP_DNS_API_DEFINE_ERRORS    1
 #endif



More information about the vc mailing list