Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 317603 Details for
Bug 105371
RFE: exit/kill strace with traced child's exitcode/signal
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Patch: exit/kill ourself with straced child's exitcode/signal
1.patch (text/plain), 1.91 KB, created by
Denys Vlasenko
on 2008-09-24 16:07:11 UTC
(
hide
)
Description:
Patch: exit/kill ourself with straced child's exitcode/signal
Filename:
MIME Type:
Creator:
Denys Vlasenko
Created:
2008-09-24 16:07:11 UTC
Size:
1.91 KB
patch
obsolete
>diff -d -urpN strace.0/strace.c strace.1/strace.c >--- strace.0/strace.c 2008-08-06 23:38:52.000000000 +0200 >+++ strace.1/strace.c 2008-09-24 17:56:01.000000000 +0200 >@@ -85,6 +85,9 @@ static int iflag = 0, interactive = 0, p > /* Sometimes we want to print only succeeding syscalls. */ > int not_failing_only = 0; > >+int exit_code; >+int strace_child; >+ > static char *username = NULL; > uid_t run_uid; > gid_t run_gid; >@@ -523,7 +526,8 @@ startup_child (char **argv) > progname, filename); > exit(1); > } >- switch (pid = fork()) { >+ strace_child = pid = fork(); >+ switch (pid) { > case -1: > perror("strace: fork"); > cleanup(); >@@ -879,7 +883,17 @@ main(int argc, char *argv[]) > if (trace() < 0) > exit(1); > cleanup(); >- exit(0); >+ fflush(NULL); >+ if (exit_code > 0xff) { >+ /* Child was killed by a signal, mimic that. */ >+ exit_code = exit_code & 0xff; >+ signal(exit_code, SIG_DFL); >+ kill(getpid(), exit_code); >+ /* Paranoia - what if this signal is not fatal? >+ Exit with 128 + signo then. */ >+ exit_code += 128; >+ } >+ exit(exit_code); > } > > int >@@ -1783,7 +1797,7 @@ int pfd; > switch (fork()) { > case -1: > perror("fork"); >- _exit(0); >+ _exit(1); > case 0: > break; > default: >@@ -1807,7 +1821,7 @@ int pfd; > > if (getrlimit(RLIMIT_NOFILE, &rl) < 0) { > perror("getrlimit(RLIMIT_NOFILE, ...)"); >- _exit(0); >+ _exit(1); > } > n = rl.rlim_cur; > for (i = 0; i < n; i++) { >@@ -2322,6 +2336,8 @@ Process %d attached (waiting for parent) > continue; > } > if (WIFSIGNALED(status)) { >+ if (pid == strace_child) >+ exit_code = 0x100 | WTERMSIG(status); > if (!cflag > && (qual_flags[WTERMSIG(status)] & QUAL_SIGNAL)) { > printleader(tcp); >@@ -2341,6 +2357,8 @@ Process %d attached (waiting for parent) > continue; > } > if (WIFEXITED(status)) { >+ if (pid == strace_child) >+ exit_code = WEXITSTATUS(status); > if (debug) > fprintf(stderr, "pid %u exited\n", pid); > if ((tcp->flags & TCB_ATTACHED)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 105371
:
94716
|
96530
|
115496
|
117548
|
123341
| 317603 |
318019