sockets

Erwan Jahier Erwan.Jahier at irisa.fr
Sat Feb 20 03:40:35 AEDT 1999


| On 09-Feb-1999, Erwan Jahier <Erwan.Jahier at irisa.fr> wrote:
| > This change implement the retry command for the external debugger.

[...]

| mercury_trace_external.c:
| > -		len = SUN_LEN(&unix_address);
| > -	} else {
| > +		len = sizeof(&unix_address);
| > +	}  else {
| 
| That change isn't documented in the log message.
| 
| The additional space before the "else" is probably a mistake.
| 
| I don't remember what SUN_LEN() was supposed to be --
| it may be worth checking Stevens, "Advanced Programming in
| the UNIX environment", which is probably where it came from --
| but the use of `sizeof(&unix_address)' looks to me like it could
| well wrong; I think maybe `sizeof(unix_address)' might be
| what was intended.

According to what is said in:

http://coloris:8888/ab2/coll.45.4/TRANSPORTPG/@Ab2PageView/1045?DwebQuery=sockets#FirstHit

section "Connection establishment", the correct code seems to be:

Index: trace/mercury_trace_external.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_external.c,v
retrieving revision 1.9
diff -u -r1.9 mercury_trace_external.c
--- mercury_trace_external.c	1999/02/19 16:17:49	1.9
+++ mercury_trace_external.c	1999/02/19 16:35:37
@@ -217,7 +217,8 @@
 		unix_address.sun_family = AF_UNIX;
 		strcpy(unix_address.sun_path, unix_socket);
 		addr = (struct sockaddr *) &unix_address;
-		len = SUN_LEN(&unix_address);
+		len = strlen(unix_address.sun_path) + 
+			sizeof(unix_address.sun_family);
 	} else {
 		char hostname[255];
 		char port_string[255];

Every alternatives work except the "SUN_LEN(&unix_address);" which fails to 
compile.
-- 
R1.





More information about the developers mailing list