mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-30 22:05:36 +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;
|
||||
}
|
||||
|
||||
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) {
|
||||
|
||||
@@ -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));
|
||||
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) {
|
||||
pr_err("Error reading socket name from image (%d)", ret);
|
||||
goto err;
|
||||
@@ -786,7 +786,7 @@ err:
|
||||
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;
|
||||
|
||||
@@ -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));
|
||||
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) {
|
||||
pr_err("Error reading socket name from image (%d)", ret);
|
||||
goto err;
|
||||
@@ -904,11 +904,11 @@ static int open_unix_sk(struct unix_sk_entry *ue, int *img_fd)
|
||||
|
||||
switch (ue->type) {
|
||||
case SOCK_STREAM:
|
||||
if (open_unix_sk_stream(sk, ue, img_fd))
|
||||
if (open_unix_sk_stream(sk, ue, *img_fd))
|
||||
goto err;
|
||||
break;
|
||||
case SOCK_DGRAM:
|
||||
if (open_unix_sk_dgram(sk, ue, img_fd))
|
||||
if (open_unix_sk_dgram(sk, ue, *img_fd))
|
||||
goto err;
|
||||
break;
|
||||
default:
|
||||
|
Reference in New Issue
Block a user