Commit b110af6e authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

sk-inet: No need for 128 byte address

The SO_PEERNAME sockopt reports -EINVAL if the len passed is greater
than the real one, and copies part of the address otherwise. Need to
pass there "good" optlen not to get -EINVAL falsely. On the other
hand, since we only need to check for connected/not-connected it's
enough to push there 1 byte.
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 76221d96
......@@ -156,7 +156,7 @@ static int can_dump_inet_sk(const struct inet_sk_desc *sk)
static struct inet_sk_desc *gen_uncon_sk(int lfd, const struct fd_parms *p)
{
struct inet_sk_desc *sk;
char address[128];
char address;
socklen_t aux;
int ret;
......@@ -166,7 +166,7 @@ static struct inet_sk_desc *gen_uncon_sk(int lfd, const struct fd_parms *p)
/* It should has no peer name */
aux = sizeof(address);
ret = getsockopt(lfd, SOL_SOCKET, SO_PEERNAME, address, &aux);
ret = getsockopt(lfd, SOL_SOCKET, SO_PEERNAME, &address, &aux);
if (ret != -1 || errno != ENOTCONN) {
pr_err("Errno %d returned from unconnected socket\n", errno);
goto err;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment