mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-31 14:25:49 +00:00
sockets: Use RW API in bind sk helper
Signed-off-by: Pavel Emelyanov <xemul@parallels.com> Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
This commit is contained in:
committed by
Cyrill Gorcunov
parent
57eea3d3fd
commit
bc9089e57e
@@ -815,7 +815,6 @@ static int bind_unix_sk(int sk, struct unix_sk_entry *ue, int img_fd)
|
|||||||
{
|
{
|
||||||
struct sockaddr_un addr;
|
struct sockaddr_un addr;
|
||||||
struct unix_sk_listen *e;
|
struct unix_sk_listen *e;
|
||||||
int ret;
|
|
||||||
|
|
||||||
if (!ue->namelen || ue->namelen >= UNIX_PATH_MAX) {
|
if (!ue->namelen || ue->namelen >= UNIX_PATH_MAX) {
|
||||||
pr_err("Bad unix name len %d\n", ue->namelen);
|
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));
|
memset(&addr, 0, sizeof(addr));
|
||||||
addr.sun_family = AF_UNIX;
|
addr.sun_family = AF_UNIX;
|
||||||
|
|
||||||
ret = read(img_fd, &addr.sun_path, ue->namelen);
|
if (read_img_buf(img_fd, &addr.sun_path, ue->namelen) < 0)
|
||||||
if (ret != ue->namelen) {
|
|
||||||
pr_err("Error reading socket name from image (%d)", ret);
|
|
||||||
goto err;
|
goto err;
|
||||||
}
|
|
||||||
|
|
||||||
if (addr.sun_path[0] != '\0')
|
if (addr.sun_path[0] != '\0')
|
||||||
unlink(addr.sun_path);
|
unlink(addr.sun_path);
|
||||||
|
|
||||||
if (bind(sk, (struct sockaddr *)&addr,
|
if (bind(sk, (struct sockaddr *)&addr,
|
||||||
sizeof(addr.sun_family) + ue->namelen) < 0) {
|
sizeof(addr.sun_family) + ue->namelen) < 0) {
|
||||||
pr_perror("Can't bind socket");
|
pr_perror("Can't bind socket");
|
||||||
|
Reference in New Issue
Block a user