Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F103017524
D41122.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
880 B
Referenced Files
None
Subscribers
None
D41122.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D41122: proc_detach: use ptrace(PT_KILL) to kill the tracee
Attached
Detach File
Event Timeline
Log In to Comment