Skip to content

Commit

Permalink
kerndat: Make errors from clone3() check more precise.
Browse files Browse the repository at this point in the history
Signed-off-by: Michał Mirosław <[email protected]>
  • Loading branch information
osctobe committed Aug 28, 2023
1 parent 92b96a5 commit a04fac5
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions criu/kerndat.c
Original file line number Diff line number Diff line change
Expand Up @@ -1417,17 +1417,20 @@ static bool kerndat_has_clone3_set_tid(void)
*/
pid = syscall(__NR_clone3, &args, sizeof(args));

if (pid == -1 && (errno == ENOSYS || errno == E2BIG)) {
kdat.has_clone3_set_tid = false;
return 0;
}
if (pid == -1 && errno == EINVAL) {
kdat.has_clone3_set_tid = true;
} else {
pr_perror("Unexpected error from clone3");
if (pid != -1) {
pr_err("Unexpected success: clone3() returned %d\n", pid);
return -1;
}

if (errno == ENOSYS || errno == E2BIG)
return 0;

if (errno != EINVAL) {
pr_pwarn("Unexpected error from clone3");
return 0;
}

kdat.has_clone3_set_tid = true;
return 0;
}

Expand Down

0 comments on commit a04fac5

Please sign in to comment.