* bug#74871: [PATCH] When socket bind or connect fails with a string address, display that address in the error message.
[not found] <17cfe670b5adc0736985a593991d5adee99eeddb.camel@rdmp.org>
@ 2024-12-14 15:38 ` Dale Mellor
0 siblings, 0 replies; only message in thread
From: Dale Mellor @ 2024-12-14 15:38 UTC (permalink / raw)
To: 74871
Too often the message 'connect: no such file or directory' appears deep
in network code, and it is very hard to figure out where it is coming
from. At least seeing the path (for example, in the case of a UNIX
socket) will help the user to debug their code.
* libguile/socket.c: extra error handling in scm_bind and scm_connect
functions.
---
libguile/socket.c | 28 ++++++++++++++++++++++++++--
1 file changed, 26 insertions(+), 2 deletions(-)
diff --git a/libguile/socket.c b/libguile/socket.c
index 101afd80d..9deecb48c 100644
--- a/libguile/socket.c
+++ b/libguile/socket.c
@@ -932,7 +932,19 @@ SCM_DEFINE (scm_connect, "connect", 2, 1, 1,
errno = save_errno;
if (errno == EINPROGRESS || errno == EAGAIN)
return SCM_BOOL_F;
- SCM_SYSERROR;
+ if (scm_is_string (address))
+ {
+ SCM_SYSERROR_MSG
+ ("'~A': ~A",
+ scm_cons (address,
+ scm_cons (scm_strerror (scm_from_int (errno)),
+ SCM_EOL)),
+ errno);
+ }
+ else
+ {
+ SCM_SYSERROR;
+ }
}
free (soka);
return SCM_BOOL_T;
@@ -1002,7 +1014,19 @@ SCM_DEFINE (scm_bind, "bind", 2, 1, 1,
free (soka);
errno = save_errno;
- SCM_SYSERROR;
+ if (scm_is_string (address))
+ {
+ SCM_SYSERROR_MSG
+ ("'~A': ~A",
+ scm_cons (address,
+ scm_cons (scm_strerror (scm_from_int (errno)),
+ SCM_EOL)),
+ errno);
+ }
+ else
+ {
+ SCM_SYSERROR;
+ }
}
free (soka);
return SCM_UNSPECIFIED;
--
2.46.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2024-12-14 15:38 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <17cfe670b5adc0736985a593991d5adee99eeddb.camel@rdmp.org>
2024-12-14 15:38 ` bug#74871: [PATCH] When socket bind or connect fails with a string address, display that address in the error message Dale Mellor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).