Correctly fill in the sun_len for a sockaddr_sun.

Submitted by:	Alexander Leidinger <Alexander@leidinger.net>
This commit is contained in:
Brian Feldman 2001-02-04 20:23:17 +00:00
parent a61d605eda
commit ffd692be66

View File

@ -748,7 +748,8 @@ main(int ac, char **av)
memset(&sunaddr, 0, sizeof(sunaddr));
sunaddr.sun_family = AF_UNIX;
strlcpy(sunaddr.sun_path, socket_name, sizeof(sunaddr.sun_path));
if (bind(sock, (struct sockaddr *) & sunaddr, sizeof(sunaddr)) < 0) {
sunaddr.sun_len = SUN_LEN(&sunaddr) + 1;
if (bind(sock, (struct sockaddr *)&sunaddr, sunaddr.sun_len) < 0) {
perror("bind");
cleanup_exit(1);
}