Commit 080282df authored by Pavel Emelyanov's avatar Pavel Emelyanov

unix: Simplify unix post-open callback

The fd we want to work on is the 2nd argument, no need
in calculating it out of file_desc.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 2f5d7098
......@@ -504,7 +504,6 @@ static int post_open_unix_sk(struct file_desc *d, int fd)
{
struct unix_sk_info *ui;
struct unix_sk_info *peer;
struct fdinfo_list_entry *fle;
struct sockaddr_un addr;
ui = container_of(d, struct unix_sk_info, d);
......@@ -518,8 +517,6 @@ static int post_open_unix_sk(struct file_desc *d, int fd)
pr_info("\tConnect %#x to %#x\n", ui->ue->ino, peer->ue->ino);
fle = file_master(&ui->d);
/* Skip external sockets */
if (!list_empty(&peer->d.fd_info_head))
futex_wait_while(&peer->bound, 0);
......@@ -528,23 +525,23 @@ static int post_open_unix_sk(struct file_desc *d, int fd)
addr.sun_family = AF_UNIX;
memcpy(&addr.sun_path, peer->name, peer->ue->name.len);
if (connect(fle->fe->fd, (struct sockaddr *)&addr,
if (connect(fd, (struct sockaddr *)&addr,
sizeof(addr.sun_family) +
peer->ue->name.len) < 0) {
pr_perror("Can't connect %#x socket", ui->ue->ino);
return -1;
}
if (restore_sk_queue(fle->fe->fd, peer->ue->id))
if (restore_sk_queue(fd, peer->ue->id))
return -1;
if (rst_file_params(fle->fe->fd, ui->ue->fown, ui->ue->flags))
if (rst_file_params(fd, ui->ue->fown, ui->ue->flags))
return -1;
if (restore_socket_opts(fle->fe->fd, ui->ue->opts))
if (restore_socket_opts(fd, ui->ue->opts))
return -1;
if (shutdown_unix_sk(fle->fe->fd, ui))
if (shutdown_unix_sk(fd, ui))
return -1;
return 0;
......
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