1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-30 16:51:41 +00:00

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
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=72023

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);
}