diff options
author | Denys Vlasenko <dvlasenk@redhat.com> | 2013-06-21 16:41:50 +0200 |
---|---|---|
committer | Denys Vlasenko <dvlasenk@redhat.com> | 2013-06-21 16:41:50 +0200 |
commit | 1b2bfbc8257231c18dcdd30b8a84eadffbe9417a (patch) | |
tree | d1a234ab6e41baab2278248714175133d8aeb2ee /strace.c | |
parent | 4e020c0f4b054a030ce8922906cdc217c4b2faf4 (diff) | |
download | android_external_strace-1b2bfbc8257231c18dcdd30b8a84eadffbe9417a.tar.gz android_external_strace-1b2bfbc8257231c18dcdd30b8a84eadffbe9417a.tar.bz2 android_external_strace-1b2bfbc8257231c18dcdd30b8a84eadffbe9417a.zip |
Fix debug output of wait4 result (was reusing buf[] on unknown events)
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Diffstat (limited to 'strace.c')
-rw-r--r-- | strace.c | 10 |
1 files changed, 3 insertions, 7 deletions
@@ -2001,7 +2001,7 @@ trace(void) event = ((unsigned)status >> 16); if (debug_flag) { char buf[sizeof("WIFEXITED,exitcode=%u") + sizeof(int)*3 /*paranoia:*/ + 16]; - char evbuf[sizeof(",PTRACE_EVENT_?? (%u)") + sizeof(int)*3 /*paranoia:*/ + 16]; + char evbuf[sizeof(",EVENT_VFORK_DONE (%u)") + sizeof(int)*3 /*paranoia:*/ + 16]; strcpy(buf, "???"); if (WIFSIGNALED(status)) #ifdef WCOREDUMP @@ -2031,16 +2031,12 @@ trace(void) [PTRACE_EVENT_EXIT] = "EXIT", /* [PTRACE_EVENT_STOP (=128)] would make biggish array */ }; - const char *e; + const char *e = "??"; if (event < ARRAY_SIZE(event_names)) e = event_names[event]; else if (event == PTRACE_EVENT_STOP) e = "STOP"; - else { - sprintf(buf, "?? (%u)", event); - e = buf; - } - sprintf(evbuf, ",PTRACE_EVENT_%s", e); + sprintf(evbuf, ",EVENT_%s (%u)", e, event); } fprintf(stderr, " [wait(0x%04x) = %u] %s%s\n", status, pid, buf, evbuf); } |