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 <emmir@google.com>
  • Loading branch information
osctobe committed Aug 25, 2023
1 parent 020cf3b commit 411db48
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 @@ -1406,17 +1406,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 411db48

Please sign in to comment.