[CRIU] [PATCH 11/12] sockets: Use RW API in bind sk helper
Pavel Emelyanov
xemul at parallels.com
Tue Feb 7 06:59:12 EST 2012
Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
---
-------------- next part --------------
From 8d1f360a5fbb9c06dca00fdfb1b0f7d7034da417 Mon Sep 17 00:00:00 2001
From: Pavel Emelyanov <xemul at parallels.com>
Date: Mon, 6 Feb 2012 18:07:32 +0400
Subject: [PATCH 11/12] small cleanup
---
sockets.c | 7 ++-----
1 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/sockets.c b/sockets.c
index b270862..ba25a5f 100644
--- a/sockets.c
+++ b/sockets.c
@@ -815,7 +815,6 @@ static int bind_unix_sk(int sk, struct unix_sk_entry *ue, int img_fd)
{
struct sockaddr_un addr;
struct unix_sk_listen *e;
- int ret;
if (!ue->namelen || ue->namelen >= UNIX_PATH_MAX) {
pr_err("Bad unix name len %d\n", ue->namelen);
@@ -825,14 +824,12 @@ static int bind_unix_sk(int sk, struct unix_sk_entry *ue, int img_fd)
memset(&addr, 0, sizeof(addr));
addr.sun_family = AF_UNIX;
- ret = read(img_fd, &addr.sun_path, ue->namelen);
- if (ret != ue->namelen) {
- pr_err("Error reading socket name from image (%d)", ret);
+ if (read_img_buf(img_fd, &addr.sun_path, ue->namelen) < 0)
goto err;
- }
if (addr.sun_path[0] != '\0')
unlink(addr.sun_path);
+
if (bind(sk, (struct sockaddr *)&addr,
sizeof(addr.sun_family) + ue->namelen) < 0) {
pr_perror("Can't bind socket");
--
1.6.5.2
More information about the CRIU
mailing list