Skip to content

Commit

Permalink
criu/proc_parse: refactor the eventpoll parser
Browse files Browse the repository at this point in the history
Eventpollentry's fields are set only when ret == 3 or ret == 6. The
remaining cases can be grouped together to an error

Signed-off-by: Taemin Ha <[email protected]>
Signed-off-by: Andrei Vagin <[email protected]>
  • Loading branch information
Taemin Ha authored and avagin committed Oct 8, 2023
1 parent c03c737 commit ab73a84
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions criu/proc_parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -1972,18 +1972,15 @@ static int parse_fdinfo_pid_s(int pid, int fd, int type, void *arg)
" pos:%lli ino:%lx sdev:%x",
&e->tfd, &e->events, (long long *)&e->data, (long long *)&e->pos,
(long *)&e->inode, &e->dev);
if (ret < 3 || ret > 6) {
eventpoll_tfd_entry__free_unpacked(e, NULL);
goto parse_err;
} else if (ret == 3) {
if (ret == 3) {
e->has_dev = false;
e->has_inode = false;
e->has_pos = false;
} else if (ret == 6) {
e->has_dev = true;
e->has_inode = true;
e->has_pos = true;
} else if (ret < 6) {
} else {
eventpoll_tfd_entry__free_unpacked(e, NULL);
goto parse_err;
}
Expand Down

0 comments on commit ab73a84

Please sign in to comment.