From 822ea856401131bc304c20fccd5825f944bb0940 Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Mon, 19 Aug 2024 10:09:09 +0800 Subject: [PATCH] otp_net.c: use EAI_OVERFLOW when it is defined Closes: https://github.com/atomvm/AtomVM/issues/1254 Signed-off-by: Sergey Fedorov --- src/libAtomVM/otp_net.c | 2 ++ src/platforms/generic_unix/lib/CMakeLists.txt | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/src/libAtomVM/otp_net.c b/src/libAtomVM/otp_net.c index a57a0aba..b40e1f2e 100644 --- src/libAtomVM/otp_net.c +++ src/libAtomVM/otp_net.c @@ -85,8 +85,10 @@ static term eai_errno_to_term(int err, GlobalContext *glb) #ifdef HAVE_EXTENDED_EAI_ERRNO case EAI_BADHINTS: return globalcontext_make_atom(glb, ATOM_STR("\xB", "eaibadhints")); +#ifdef HAVE_EAI_OVERFLOW case EAI_OVERFLOW: return globalcontext_make_atom(glb, ATOM_STR("\xB", "eaioverflow")); +#endif case EAI_PROTOCOL: return globalcontext_make_atom(glb, ATOM_STR("\xB", "eaiprotocol")); case EAI_SYSTEM: diff --git a/src/platforms/generic_unix/lib/CMakeLists.txt b/src/platforms/generic_unix/lib/CMakeLists.txt index b02dba9b..90bfc30f 100644 --- src/platforms/generic_unix/lib/CMakeLists.txt +++ src/platforms/generic_unix/lib/CMakeLists.txt @@ -102,6 +102,10 @@ check_symbol_exists(EAI_BADHINTS "netdb.h" HAVE_EXTENDED_EAI_ERRNO) if (HAVE_EXTENDED_EAI_ERRNO) target_compile_definitions(libAtomVM${PLATFORM_LIB_SUFFIX} PUBLIC HAVE_EXTENDED_EAI_ERRNO) endif() +check_symbol_exists(EAI_OVERFLOW "netdb.h" HAVE_EAI_OVERFLOW) +if (HAVE_EAI_OVERFLOW) + target_compile_definitions(libAtomVM${PLATFORM_LIB_SUFFIX} PUBLIC HAVE_EAI_OVERFLOW) +endif() if (COVERAGE) include(CodeCoverage)