2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-30 22:05:36 +00:00

restore: Check for incomplete reading of vma-entry

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
This commit is contained in:
Cyrill Gorcunov
2011-11-23 01:18:01 +04:00
parent 2beec2268b
commit 7ce2761007

View File

@@ -698,9 +698,14 @@ static int fixup_vma_fds(int pid, int fd)
while (1) {
struct vma_entry vi;
int ret = 0;
if (read(fd, &vi, sizeof(vi)) != sizeof(vi)) {
ret = read(fd, &vi, sizeof(vi));
if (ret < 0) {
pr_perror("%d: Can't read vma_entry\n", pid);
} else if (ret != sizeof(vi)) {
pr_err("%d: Incomplete vma_entry (%d != %d)\n",
pid, ret, sizeof(vi));
return 1;
}