Correctly calculate length of local-domain socket name for RSRR server.
This commit is contained in:
parent
a84c980cdc
commit
256c0feec5
@ -33,6 +33,8 @@
|
|||||||
#ifdef RSRR
|
#ifdef RSRR
|
||||||
|
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
|
#include <sys/param.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
/* Taken from prune.c */
|
/* Taken from prune.c */
|
||||||
/*
|
/*
|
||||||
@ -84,7 +86,13 @@ rsrr_init()
|
|||||||
bzero((char *) &serv_addr, sizeof(serv_addr));
|
bzero((char *) &serv_addr, sizeof(serv_addr));
|
||||||
serv_addr.sun_family = AF_UNIX;
|
serv_addr.sun_family = AF_UNIX;
|
||||||
strcpy(serv_addr.sun_path, RSRR_SERV_PATH);
|
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);
|
servlen = sizeof(serv_addr.sun_family) + strlen(serv_addr.sun_path);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (bind(rsrr_socket, (struct sockaddr *) &serv_addr, servlen) < 0)
|
if (bind(rsrr_socket, (struct sockaddr *) &serv_addr, servlen) < 0)
|
||||||
log(LOG_ERR, errno, "Can't bind RSRR socket");
|
log(LOG_ERR, errno, "Can't bind RSRR socket");
|
||||||
|
Loading…
Reference in New Issue
Block a user