1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-05 09:14:03 +00:00

Correctly calculate length of local-domain socket name for RSRR server.

This commit is contained in:
Garrett Wollman 1995-06-15 18:30:44 +00:00
parent 00a838879b
commit 783570d79c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=9236

View File

@ -33,6 +33,8 @@
#ifdef RSRR
#include "defs.h"
#include <sys/param.h>
#include <stddef.h>
/* Taken from prune.c */
/*
@ -84,7 +86,13 @@ rsrr_init()
bzero((char *) &serv_addr, sizeof(serv_addr));
serv_addr.sun_family = AF_UNIX;
strcpy(serv_addr.sun_path, RSRR_SERV_PATH);
#if BSD >= 199103
servlen = offsetof(struct sockaddr_un, sun_path)
+ strlen(serv_addr.sun_path);
serv_addr.sun_len = servlen;
#else
servlen = sizeof(serv_addr.sun_family) + strlen(serv_addr.sun_path);
#endif
if (bind(rsrr_socket, (struct sockaddr *) &serv_addr, servlen) < 0)
log(LOG_ERR, errno, "Can't bind RSRR socket");