mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-30 13:58:34 +00:00
utils: Cleanup open_fd_of_vpid()
Move +1 up to snprintf(). Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com> Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
This commit is contained in:
committed by
Andrei Vagin
parent
1349c6439c
commit
a5483337b3
@@ -1413,14 +1413,14 @@ int open_fd_of_vpid(pid_t pid, int fd, int flags)
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
item = pstree_pid_by_virt(pid)->item;
|
item = pstree_pid_by_virt(pid)->item;
|
||||||
ret = sprintf(path, "%d/fd/%d", item->pid->real, fd);
|
ret = sprintf(path, "%d/fd/%d", item->pid->real, fd) + 1;
|
||||||
pr_info("Opening /proc/%s on the criu side\n", path);
|
pr_info("Opening /proc/%s on the criu side\n", path);
|
||||||
if (flags == O_RDONLY)
|
if (flags == O_RDONLY)
|
||||||
ret = userns_call(fn_open_proc_r, UNS_FDOUT, path, ret + 1, -1);
|
ret = userns_call(fn_open_proc_r, UNS_FDOUT, path, ret, -1);
|
||||||
else if (flags == O_WRONLY)
|
else if (flags == O_WRONLY)
|
||||||
ret = userns_call(fn_open_proc_w, UNS_FDOUT, path, ret + 1, -1);
|
ret = userns_call(fn_open_proc_w, UNS_FDOUT, path, ret, -1);
|
||||||
else if (flags == O_RDWR)
|
else if (flags == O_RDWR)
|
||||||
ret = userns_call(fn_open_proc_rw, UNS_FDOUT, path, ret + 1, -1);
|
ret = userns_call(fn_open_proc_rw, UNS_FDOUT, path, ret, -1);
|
||||||
else
|
else
|
||||||
BUG();
|
BUG();
|
||||||
return ret;
|
return ret;
|
||||||
|
Reference in New Issue
Block a user