[CRIU] [crtools-bot] sockets: Use RW API in bind sk helper
Cyrill Gorcunov
gorcunov at openvz.org
Tue Feb 7 08:27:58 EST 2012
The commit is pushed to "master" and will appear on git://github.com/cyrillos/crtools.git
--------------->
commit bc9089e57edda2c53b2aab0f9cd6b2ee5da191dc
Author: Pavel Emelyanov <xemul at parallels.com>
Date: Tue Feb 7 15:59:12 2012 +0400
sockets: Use RW API in bind sk helper
Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
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");
More information about the CRIU
mailing list