Skip to content

Commit

Permalink
Ignore ptrace(PTRACE_SEIZE) error on ESRCH (No such process)
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianM27 authored and Mariusz Kozłowski committed Sep 20, 2023
1 parent bae229b commit 6cbc4ce
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion memcr.c
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,12 @@ static int seize_pid(pid_t pid)

ret = ptrace(PTRACE_SEIZE, pid, NULL, 0);
if (ret) {
fprintf(stderr, "ptrace(PTRACE_SEIZE) pid %d: %m\n", pid);
if (errno == ESRCH) {
fprintf(stderr, "ptrace(PTRACE_SEIZE) pid %d: %m, ignoring\n", pid);
return 0;
}

fprintf(stderr, "ptrace(PTRACE_SEIZE) %d pid %d: %m\n", errno, pid);
return 1;
}

Expand Down

0 comments on commit 6cbc4ce

Please sign in to comment.