Commit 0b3bf4b1 authored by Martin Mareš's avatar Martin Mareš

Use SUN_LEN() for length of UNIX domain addresses. This should fix problems

with connection to clients on libc5 machines.
parent 0e376168
......@@ -250,7 +250,7 @@ server_connect(void)
bzero(&sa, sizeof(sa));
sa.sun_family = AF_UNIX;
strcpy(sa.sun_path, server_path);
if (connect(server_fd, (struct sockaddr *) &sa, sizeof(struct sockaddr)) < 0)
if (connect(server_fd, (struct sockaddr *) &sa, SUN_LEN(&sa)) < 0)
die("Unable to connect to server control socket (%s): %m", server_path);
if (fcntl(server_fd, F_SETFL, O_NONBLOCK) < 0)
die("fcntl: %m");
......
......@@ -774,7 +774,7 @@ sk_open_unix(sock *s, char *name)
unlink(name);
sa.sun_family = AF_UNIX;
strcpy(sa.sun_path, name);
if (bind(fd, (struct sockaddr *) &sa, sizeof(sa)) < 0)
if (bind(fd, (struct sockaddr *) &sa, SUN_LEN(&sa)) < 0)
ERR("bind");
if (listen(fd, 8))
ERR("listen");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment