File 3102-erts-enet-Fixed-enet-get-if-entry-function.patch of Package erlang

From dbf6102ab37bce205a3a46752178fbe032e08f68 Mon Sep 17 00:00:00 2001
From: Micael Karlberg <bmk@erlang.org>
Date: Mon, 2 Jun 2025 18:50:33 +0200
Subject: [PATCH 02/14] [erts|enet] Fixed enet get-if-entry function

---
 erts/emulator/nifs/common/prim_net_nif.c    | 16 ++++++++++++----
 erts/emulator/nifs/common/prim_socket_nif.c |  1 +
 erts/emulator/nifs/common/socket_int.h      |  1 +
 3 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/erts/emulator/nifs/common/prim_net_nif.c b/erts/emulator/nifs/common/prim_net_nif.c
index 802b61d365..e026103965 100644
--- a/erts/emulator/nifs/common/prim_net_nif.c
+++ b/erts/emulator/nifs/common/prim_net_nif.c
@@ -3227,36 +3227,44 @@ ERL_NIF_TERM enet_get_if_entry(ErlNifEnv* env,
     ifRow.dwIndex = index;
     ret = GetIfEntry(&ifRow);
 
-    NDBG2( dbg,
-           ("NET", "nif_get_if_entry -> get-if-entru result:"
-            "\r\n   %d\r\n", ret) );
-
     switch (ret) {
         /* Success */
     case NO_ERROR:
+        NDBG2( dbg, ("NET", "nif_get_if_entry -> success") );
         eifRow = enet_if_row_encode(env, dbg, &ifRow);
         result = esock_make_ok2(env, eifRow);
         break;
 
         /* Known errors */
     case ERROR_CAN_NOT_COMPLETE:
+        NDBG2( dbg, ("NET", "nif_get_if_entry -> error: can-not-complete") );
         result = esock_make_error(env, atom_can_not_complete);
         break;
     case ERROR_INVALID_DATA:
+        NDBG2( dbg, ("NET", "nif_get_if_entry -> error: invalid-data") );
         result = esock_make_error(env, atom_invalid_data);
         break;
     case ERROR_INVALID_PARAMETER:
+        NDBG2( dbg, ("NET", "nif_get_if_entry -> error: invalid-parameter") );
         result = esock_make_error(env, atom_invalid_parameter);
         break;
     case ERROR_NOT_FOUND:
+        NDBG2( dbg, ("NET", "nif_get_if_entry -> error: not-found") );
         result = esock_make_error(env, esock_atom_not_found);
         break;
+    case ERROR_FILE_NOT_FOUND:
+        NDBG2( dbg, ("NET", "nif_get_if_entry -> error: file-not-found") );
+        result = esock_make_error(env, esock_atom_file_not_found);
+        break;
     case ERROR_NOT_SUPPORTED:
+        NDBG2( dbg, ("NET", "nif_get_if_entry -> error: not-supported") );
         result = esock_make_error(env, atom_not_supported);
         break;
 
         /* Other errors */
     default:
+        NDBG2( dbg,
+               ("NET", "nif_get_if_entry -> error: %d\r\n", ret) );
         result = esock_make_error(env, MKI(env, ret));
         break;
     }
diff --git a/erts/emulator/nifs/common/prim_socket_nif.c b/erts/emulator/nifs/common/prim_socket_nif.c
index ac76306b80..34ff33c1cb 100644
--- a/erts/emulator/nifs/common/prim_socket_nif.c
+++ b/erts/emulator/nifs/common/prim_socket_nif.c
@@ -2073,6 +2073,7 @@ static const struct in6_addr in6addr_loopback =
     GLOBAL_ATOM_DECL(family);                          \
     GLOBAL_ATOM_DECL(fastroute);                       \
     GLOBAL_ATOM_DECL(fast_retrans);                    \
+    GLOBAL_ATOM_DECL(file_not_found);                  \
     GLOBAL_ATOM_DECL(fin_wait_1);                      \
     GLOBAL_ATOM_DECL(fin_wait_2);                      \
     GLOBAL_ATOM_DECL(flags);                           \
diff --git a/erts/emulator/nifs/common/socket_int.h b/erts/emulator/nifs/common/socket_int.h
index c28cda8a82..02d60506b8 100644
--- a/erts/emulator/nifs/common/socket_int.h
+++ b/erts/emulator/nifs/common/socket_int.h
@@ -349,6 +349,7 @@ typedef long ssize_t;
     GLOBAL_ATOM_DEF(family);                   \
     GLOBAL_ATOM_DEF(fastroute);                \
     GLOBAL_ATOM_DEF(fast_retrans);             \
+    GLOBAL_ATOM_DEF(file_not_found);           \
     GLOBAL_ATOM_DEF(fin_wait_1);               \
     GLOBAL_ATOM_DEF(fin_wait_2);               \
     GLOBAL_ATOM_DEF(flags);                    \
-- 
2.43.0

openSUSE Build Service is sponsored by