File 7705-erts-inet-drv-Fixed-debug-printout.patch of Package erlang

From 87f746b40b11531cf25fbbfb7ac33d6e8e03a279 Mon Sep 17 00:00:00 2001
From: Micael Karlberg <bmk@erlang.org>
Date: Wed, 1 Jun 2022 20:08:55 +0200
Subject: [PATCH 5/7] [erts|inet-drv] Fixed debug printout

The printout cound not be done in some cases.
There was a driver_exit call in some cases. If that
was the case the debug printout could not be done,
since it used the debug flag (among other things).

OTP-18032
---
 erts/emulator/drivers/common/inet_drv.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/erts/emulator/drivers/common/inet_drv.c b/erts/emulator/drivers/common/inet_drv.c
index 136debcc7a..d708afd0e8 100644
--- a/erts/emulator/drivers/common/inet_drv.c
+++ b/erts/emulator/drivers/common/inet_drv.c
@@ -10031,9 +10031,12 @@ static ErlDrvSSizeT inet_ctl(inet_descriptor* desc, int cmd, char* buf,
 
         sres = inet_set_opts(desc, buf, len);
 
-        DDBG(desc,
-             ("INET-DRV-DBG[%d][%d,%T] inet_ctl(setopts) -> sres: %d\r\n",
-              __LINE__, desc->s, driver_caller(desc->port), sres) );
+        /* We cannot debug-print if sres == 0 since we have then actually *
+         * completed a driver_exit => we have no longer a descriptor!     */
+        if (sres != 0)
+            DDBG(desc,
+                 ("INET-DRV-DBG[%d][%d,%T] inet_ctl(setopts) -> sres: %d\r\n",
+                  __LINE__, desc->s, driver_caller(desc->port), sres) );
 
 	switch(sres) {
 	case -1: 
-- 
2.35.3

openSUSE Build Service is sponsored by