From: Roland McGrath Date: Sat, 3 Nov 2007 23:34:11 +0000 (+0000) Subject: 2007-11-03 Jan Kratochvil X-Git-Tag: v4.5.18~108 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=54cc1c8ae2d097502439a95d43e1f0ed6782d38c;p=strace 2007-11-03 Jan Kratochvil * strace.c (main): Move the STARTUP_CHILD call before setting up the signal handlers. New comment about the valid internal states. --- diff --git a/strace.c b/strace.c index 9d82f586..b71e093b 100644 --- a/strace.c +++ b/strace.c @@ -817,6 +817,20 @@ main(int argc, char *argv[]) interactive = 0; qflag = 1; } + /* Valid states here: + optind < argc pflag_seen outfname interactive + 1 0 0 1 + 0 1 0 1 + 1 0 1 0 + 0 1 1 1 + */ + + /* STARTUP_CHILD must be called before the signal handlers get + installed below as they are inherited into the spawned process. + Also we do not need to be protected by them as during interruption + in the STARTUP_CHILD mode we kill the spawned process anyway. */ + if (!pflag_seen) + startup_child(&argv[optind]); sigemptyset(&empty_set); sigemptyset(&blocked_set); @@ -857,8 +871,6 @@ main(int argc, char *argv[]) if (pflag_seen) startup_attach(); - else - startup_child(&argv[optind]); if (trace() < 0) exit(1);