In case of normal strace termination, when the trace output is
redirected to a file or a pipe, close it and wait for the pipe
process termination.
* strace.c (main): Before normal exit, close shared_log when it
differs from stderr, and wait for popen_pid termination.
+ if (shared_log != stderr)
+ fclose(shared_log);
+ if (popen_pid) {
+ while (waitpid(popen_pid, NULL, 0) < 0 && errno == EINTR)
+ ;
+ }
if (exit_code > 0xff) {
/* Avoid potential core file clobbering. */
struct rlimit rlim = {0, 0};
if (exit_code > 0xff) {
/* Avoid potential core file clobbering. */
struct rlimit rlim = {0, 0};