[CRIU] [PATCH 2/12] sockets: Datagram connection fix
Pavel Emelyanov
xemul at parallels.com
Tue Feb 7 06:50:00 EST 2012
The address length should be the real length, not the buffer size.
Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
---
-------------- next part --------------
From 6b3098ad854e3de67b368e3a59eba94a8ca43fcc Mon Sep 17 00:00:00 2001
From: Pavel Emelyanov <xemul at parallels.com>
Date: Mon, 6 Feb 2012 13:33:33 +0400
Subject: [PATCH 02/12] sockets dgram conn fix
---
sockets.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/sockets.c b/sockets.c
index 14bad10..b0d7206 100644
--- a/sockets.c
+++ b/sockets.c
@@ -756,6 +756,7 @@ static void prep_conn_addr(int id, struct sockaddr_un *addr, int *addrlen)
struct unix_dgram_bound {
struct unix_dgram_bound *next;
struct sockaddr_un addr;
+ int addr_len;
int id;
};
@@ -783,7 +784,7 @@ static int run_connect_jobs_dgram(void)
goto err;
}
- if (connect(d->fd, (struct sockaddr *)&b->addr, sizeof(b->addr)) < 0) {
+ if (connect(d->fd, (struct sockaddr *)&b->addr, b->addr_len) < 0) {
pr_perror("Can't connect peer %d on fd %d",
d->peer, d->fd);
goto err;
@@ -852,6 +853,7 @@ static int open_unix_sk_dgram(int sk, struct unix_sk_entry *ue, int img_fd)
goto err;
memcpy(&d->addr, &addr, sizeof(d->addr));
+ d->addr_len = sizeof(addr.sun_family) + ue->namelen;
d->id = ue->id;
SK_HASH_LINK(dgram_bound, d->id, d);
--
1.6.5.2
More information about the CRIU
mailing list