2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-30 22:05:36 +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:
Kirill Tkhai
2017-06-07 14:24:01 +03:00
committed by Andrei Vagin
parent 1349c6439c
commit a5483337b3

View File

@@ -1413,14 +1413,14 @@ int open_fd_of_vpid(pid_t pid, int fd, int flags)
int ret;
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);
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)
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)
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
BUG();
return ret;