1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-02-01 06:12:31 +00:00

Correct calculation of the socklen_t length when bind-ing the AF_UNIX socket,

as some systems have extra bytes in the sockaddr_un that weren't accounted
  for in the original calculation.  Follow the POSIX spec instead.
	modified:   src/unixcomm.c
	modified:   src/unixfork.c
This commit is contained in:
Nick Briggs
2018-04-15 18:37:19 -07:00
parent 69796e34d7
commit 1a8607d412
2 changed files with 44 additions and 42 deletions

View File

@@ -472,10 +472,11 @@ int fork_Unix() {
exit(0);
}
sprintf(PipeName, "/tmp/LPU%ld-%d", StartTime, slot);
memset(&addr, 0, sizeof(struct sockaddr_un));
addr.sun_family = AF_UNIX;
strcpy(addr.sun_path, PipeName);
status =
connect(sock, (struct sockaddr *)&addr, strlen(PipeName) + sizeof(addr.sun_family));
connect(sock, (struct sockaddr *)&addr, sizeof(struct sockaddr_un));
if (status < 0) {
perror("slave connect");
printf("Name = %s.\n", PipeName);