- Portability fix for Solaris ('sun' is not usable for a variable).

git-svn-id: file:///svn/unbound/trunk@3326 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Wouter Wijngaards 2015-01-30 15:32:59 +00:00
parent 74cac624bd
commit 83ba5ffcf4
2 changed files with 6 additions and 5 deletions

View file

@ -1,6 +1,7 @@
30 January 2015: Wouter 30 January 2015: Wouter
- Fix 0x20 capsforid fallback to omit gratuitous NS and additional - Fix 0x20 capsforid fallback to omit gratuitous NS and additional
section changes. section changes.
- Portability fix for Solaris ('sun' is not usable for a variable).
29 January 2015: Wouter 29 January 2015: Wouter
- Fix pyunbound byte string representation for python3. - Fix pyunbound byte string representation for python3.

View file

@ -598,16 +598,16 @@ create_local_accept_sock(const char *path, int* noproto)
{ {
#ifdef HAVE_SYS_UN_H #ifdef HAVE_SYS_UN_H
int s; int s;
struct sockaddr_un sun; struct sockaddr_un usock;
verbose(VERB_ALGO, "creating unix socket %s", path); verbose(VERB_ALGO, "creating unix socket %s", path);
#ifdef HAVE_STRUCT_SOCKADDR_UN_SUN_LEN #ifdef HAVE_STRUCT_SOCKADDR_UN_SUN_LEN
/* this member exists on BSDs, not Linux */ /* this member exists on BSDs, not Linux */
sun.sun_len = (socklen_t)sizeof(sun); usock.sun_len = (socklen_t)sizeof(usock);
#endif #endif
sun.sun_family = AF_LOCAL; usock.sun_family = AF_LOCAL;
/* length is 92-108, 104 on FreeBSD */ /* length is 92-108, 104 on FreeBSD */
(void)strlcpy(sun.sun_path, path, sizeof(sun.sun_path)); (void)strlcpy(usock.sun_path, path, sizeof(usock.sun_path));
if ((s = socket(PF_LOCAL, SOCK_STREAM, 0)) == -1) { if ((s = socket(PF_LOCAL, SOCK_STREAM, 0)) == -1) {
log_err("Cannot create local socket %s (%s)", log_err("Cannot create local socket %s (%s)",
@ -622,7 +622,7 @@ create_local_accept_sock(const char *path, int* noproto)
return -1; return -1;
} }
if (bind(s, (struct sockaddr *)&sun, if (bind(s, (struct sockaddr *)&usock,
(socklen_t)sizeof(struct sockaddr_un)) == -1) { (socklen_t)sizeof(struct sockaddr_un)) == -1) {
log_err("Cannot bind local socket %s (%s)", log_err("Cannot bind local socket %s (%s)",
path, strerror(errno)); path, strerror(errno));