Page MenuHomeFreeBSD

D41122.diff
No OneTemporary

D41122.diff

diff --git a/lib/libproc/proc_util.c b/lib/libproc/proc_util.c
--- a/lib/libproc/proc_util.c
+++ b/lib/libproc/proc_util.c
@@ -85,25 +85,21 @@
proc_detach(struct proc_handle *phdl, int reason)
{
int status;
+ int request;
pid_t pid;
if (phdl == NULL)
return (EINVAL);
if (reason == PRELEASE_HANG)
return (EINVAL);
- if (reason == PRELEASE_KILL) {
- kill(proc_getpid(phdl), SIGKILL);
- goto free;
- }
if ((phdl->flags & PATTACH_RDONLY) != 0)
goto free;
+ request = (reason == PRELEASE_KILL) ? PT_KILL : PT_DETACH;
pid = proc_getpid(phdl);
- if (ptrace(PT_DETACH, pid, 0, 0) != 0 && errno == ESRCH)
- goto free;
- if (errno == EBUSY) {
+ if (ptrace(request, pid, 0, 0) != 0 && errno == EBUSY) {
kill(pid, SIGSTOP);
waitpid(pid, &status, WUNTRACED);
- ptrace(PT_DETACH, pid, 0, 0);
+ ptrace(request, pid, 0, 0);
kill(pid, SIGCONT);
}
free:

File Metadata

Mime Type
text/plain
Expires
Wed, Nov 20, 9:19 PM (21 h, 30 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14747519
Default Alt Text
D41122.diff (880 B)

Event Timeline