Commit 0678ea2e authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

sk-inet: More detailed error parsing on unconnected socket

errno is no guaranteed to be clear if call exit with
success. Thus make sure we've ret negative here and
test for errno then.

http://bugzilla.openvz.org/show_bug.cgi?id=2412Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent b110af6e
...@@ -167,8 +167,13 @@ static struct inet_sk_desc *gen_uncon_sk(int lfd, const struct fd_parms *p) ...@@ -167,8 +167,13 @@ static struct inet_sk_desc *gen_uncon_sk(int lfd, const struct fd_parms *p)
/* It should has no peer name */ /* It should has no peer name */
aux = sizeof(address); 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) { if (ret < 0) {
pr_err("Errno %d returned from unconnected socket\n", errno); if (errno != ENOTCONN) {
pr_perror("Unexpected error returned from unconnected socket");
goto err;
}
} else if (ret == 0) {
pr_err("Name resolved on unconnected socket\n");
goto err; 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