From 44e1d662cb57e2e4e47601350d7e29d1b1a41286 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Tue, 31 Jan 2012 18:06:51 +0000 Subject: [PATCH] * strace.cc (proc_child): Don't right-shift exit value. (main): Call ExitProcess() to exit exactly the same way as any straced child. --- winsup/utils/ChangeLog | 6 ++++++ winsup/utils/strace.cc | 7 +++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/winsup/utils/ChangeLog b/winsup/utils/ChangeLog index 3a5e94c23..fb4a43ffe 100644 --- a/winsup/utils/ChangeLog +++ b/winsup/utils/ChangeLog @@ -1,3 +1,9 @@ +2012-01-31 Christopher Faylor + + * strace.cc (proc_child): Don't right-shift exit value. + (main): Call ExitProcess() to exit exactly the same way as any straced + child. + 2012-01-29 Corinna Vinschen * tzset.c: Throughout use wide characters to be locale agnostic. diff --git a/winsup/utils/strace.cc b/winsup/utils/strace.cc index 42fb955be..f8662582d 100644 --- a/winsup/utils/strace.cc +++ b/winsup/utils/strace.cc @@ -680,7 +680,7 @@ proc_child (unsigned mask, FILE *ofile, pid_t pid) break; case EXIT_PROCESS_DEBUG_EVENT: - res = ev.u.ExitProcess.dwExitCode >> 8; + res = ev.u.ExitProcess.dwExitCode; remove_child (ev.dwProcessId); break; case EXCEPTION_DEBUG_EVENT: @@ -1076,12 +1076,11 @@ character #%d.\n", optarg, (int) (endptr - optarg), endptr); if (!ofile) ofile = stdout; - DWORD res = 0; if (toggle) dotoggle (pid); else - res = dostrace (mask, ofile, pid, argv + optind); - return res; + ExitProcess (dostrace (mask, ofile, pid, argv + optind)); + return 0; } #undef CloseHandle