diff options
author | jkim <jkim@FreeBSD.org> | 2011-10-06 21:40:08 +0000 |
---|---|---|
committer | jkim <jkim@FreeBSD.org> | 2011-10-06 21:40:08 +0000 |
commit | 5bf71ef7d883aec32fe869b288317533e4324d3e (patch) | |
tree | 50fe174eb7e005b9537acebfd2eabcacf1488140 | |
parent | f18be120377c0b30a1f1f5f755ea6282b2fa35de (diff) | |
download | FreeBSD-src-5bf71ef7d883aec32fe869b288317533e4324d3e.zip FreeBSD-src-5bf71ef7d883aec32fe869b288317533e4324d3e.tar.gz |
Remove a now-defunct variable.
-rw-r--r-- | sys/compat/linux/linux_socket.c | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c index 7273b1d..7462ca3 100644 --- a/sys/compat/linux/linux_socket.c +++ b/sys/compat/linux/linux_socket.c @@ -81,7 +81,7 @@ static int linux_to_bsd_domain(int); * family and convert to sockaddr. */ static int -linux_getsockaddr(struct sockaddr **sap, const struct osockaddr *osa, int osalen) +linux_getsockaddr(struct sockaddr **sap, const struct osockaddr *osa, int salen) { struct sockaddr *sa; struct osockaddr *kosa; @@ -90,12 +90,11 @@ linux_getsockaddr(struct sockaddr **sap, const struct osockaddr *osa, int osalen int oldv6size; #endif char *name; - int alloclen, bdom, error, hdrlen, namelen; + int bdom, error, hdrlen, namelen; - if (osalen < 2 || osalen > UCHAR_MAX || !osa) + if (salen < 2 || salen > UCHAR_MAX || !osa) return (EINVAL); - alloclen = osalen; #ifdef INET6 oldv6size = 0; /* @@ -103,15 +102,15 @@ linux_getsockaddr(struct sockaddr **sap, const struct osockaddr *osa, int osalen * if it's a v4-mapped address, so reserve the proper space * for it. */ - if (alloclen == sizeof(struct sockaddr_in6) - sizeof(uint32_t)) { - alloclen = sizeof(struct sockaddr_in6); + if (salen == sizeof(struct sockaddr_in6) - sizeof(uint32_t)) { + salen += sizeof(uint32_t); oldv6size = 1; } #endif - kosa = malloc(alloclen, M_SONAME, M_WAITOK); + kosa = malloc(salen, M_SONAME, M_WAITOK); - if ((error = copyin(osa, kosa, osalen))) + if ((error = copyin(osa, kosa, salen))) goto out; bdom = linux_to_bsd_domain(kosa->sa_family); @@ -145,18 +144,18 @@ linux_getsockaddr(struct sockaddr **sap, const struct osockaddr *osa, int osalen goto out; } } else - alloclen -= sizeof(uint32_t); + salen -= sizeof(uint32_t); } #endif if (bdom == AF_INET) { - alloclen = sizeof(struct sockaddr_in); - if (osalen < alloclen) { + if (salen < sizeof(struct sockaddr_in)) { error = EINVAL; goto out; } + salen = sizeof(struct sockaddr_in); } - if (bdom == AF_LOCAL && osalen > sizeof(struct sockaddr_un)) { + if (bdom == AF_LOCAL && salen > sizeof(struct sockaddr_un)) { hdrlen = offsetof(struct sockaddr_un, sun_path); name = ((struct sockaddr_un *)kosa)->sun_path; if (*name == '\0') { @@ -164,19 +163,19 @@ linux_getsockaddr(struct sockaddr **sap, const struct osockaddr *osa, int osalen * Linux abstract namespace starts with a NULL byte. * XXX We do not support abstract namespace yet. */ - namelen = strnlen(name + 1, osalen - hdrlen - 1) + 1; + namelen = strnlen(name + 1, salen - hdrlen - 1) + 1; } else - namelen = strnlen(name, osalen - hdrlen); + namelen = strnlen(name, salen - hdrlen); if (hdrlen + namelen > sizeof(struct sockaddr_un)) { error = ENAMETOOLONG; goto out; } - alloclen = sizeof(struct sockaddr_un); + salen = sizeof(struct sockaddr_un); } sa = (struct sockaddr *)kosa; sa->sa_family = bdom; - sa->sa_len = alloclen; + sa->sa_len = salen; *sap = sa; return (0); |