mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-31 22:35:33 +00:00
sockets: Clean usk_img dereference
There's no need in img fd pointer in opening functions. 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
5c083e128a
commit
379dde63f5
12
sockets.c
12
sockets.c
@@ -716,7 +716,7 @@ err:
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int open_unix_sk_dgram(int sk, struct unix_sk_entry *ue, int *img_fd)
|
static int open_unix_sk_dgram(int sk, struct unix_sk_entry *ue, int img_fd)
|
||||||
{
|
{
|
||||||
if (ue->namelen) {
|
if (ue->namelen) {
|
||||||
|
|
||||||
@@ -732,7 +732,7 @@ static int open_unix_sk_dgram(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);
|
ret = read(img_fd, &addr.sun_path, ue->namelen);
|
||||||
if (ret != ue->namelen) {
|
if (ret != ue->namelen) {
|
||||||
pr_err("Error reading socket name from image (%d)", ret);
|
pr_err("Error reading socket name from image (%d)", ret);
|
||||||
goto err;
|
goto err;
|
||||||
@@ -786,7 +786,7 @@ err:
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int open_unix_sk_stream(int sk, struct unix_sk_entry *ue, int *img_fd)
|
static int open_unix_sk_stream(int sk, struct unix_sk_entry *ue, int img_fd)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
@@ -806,7 +806,7 @@ static int open_unix_sk_stream(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);
|
ret = read(img_fd, &addr.sun_path, ue->namelen);
|
||||||
if (ret != ue->namelen) {
|
if (ret != ue->namelen) {
|
||||||
pr_err("Error reading socket name from image (%d)", ret);
|
pr_err("Error reading socket name from image (%d)", ret);
|
||||||
goto err;
|
goto err;
|
||||||
@@ -904,11 +904,11 @@ static int open_unix_sk(struct unix_sk_entry *ue, int *img_fd)
|
|||||||
|
|
||||||
switch (ue->type) {
|
switch (ue->type) {
|
||||||
case SOCK_STREAM:
|
case SOCK_STREAM:
|
||||||
if (open_unix_sk_stream(sk, ue, img_fd))
|
if (open_unix_sk_stream(sk, ue, *img_fd))
|
||||||
goto err;
|
goto err;
|
||||||
break;
|
break;
|
||||||
case SOCK_DGRAM:
|
case SOCK_DGRAM:
|
||||||
if (open_unix_sk_dgram(sk, ue, img_fd))
|
if (open_unix_sk_dgram(sk, ue, *img_fd))
|
||||||
goto err;
|
goto err;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
Reference in New Issue
Block a user