Forbid using mutually exclusive options -D and -p together

If we use -D and -p option together to trace a multi-thread program, in
addition to the main thread, other threads could not be traced even if we
present -f option. Moreover, when executing 'strace -D -p <non-exist pid>',
strace could not terminate normally.

* strace.c (main): Check it.

Signed-off-by: Wang Chao <wang.chao@cn.fujitsu.com>
This commit is contained in:
Wang Chao 2010-08-05 14:30:11 +08:00 committed by Dmitry V. Levin
parent 670f51126a
commit d322a4bbe1

View File

@ -846,6 +846,13 @@ main(int argc, char *argv[])
if ((optind == argc) == !pflag_seen)
usage(stderr, 1);
if (pflag_seen && daemonized_tracer) {
fprintf(stderr,
"%s: -D and -p are mutually exclusive options\n",
progname);
exit(1);
}
if (!followfork)
followfork = optF;