From: Dmitry V. Levin Date: Tue, 3 Jun 2014 13:20:05 +0000 (+0000) Subject: Warn about flags that have no effect with -c X-Git-Tag: v4.9~42 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2727aae37c56eb2620699388513ef5bbb0af2b7e;p=strace Warn about flags that have no effect with -c * strace.c (init): Issue a warning if -i, -k, -r, -t, -T, or -y is used along with -c. This fixes Debian bug #443895. --- diff --git a/strace.c b/strace.c index fe197e5d..46c9d63e 100644 --- a/strace.c +++ b/strace.c @@ -1817,11 +1817,6 @@ init(int argc, char *argv[]) error_msg_and_die("-D and -p are mutually exclusive"); } -#ifdef USE_LIBUNWIND - if (stack_trace_enabled) - unwind_init(); -#endif - if (!followfork) followfork = optF; @@ -1833,6 +1828,28 @@ init(int argc, char *argv[]) error_msg_and_die("-w must be given with (-c or -C)"); } + if (cflag == CFLAG_ONLY_STATS) { + if (iflag) + error_msg("-%c has no effect with -c", 'i'); +#ifdef USE_LIBUNWIND + if (stack_trace_enabled) + error_msg("-%c has no effect with -c", 'k'); +#endif + if (rflag) + error_msg("-%c has no effect with -c", 'r'); + if (tflag) + error_msg("-%c has no effect with -c", 't'); + if (Tflag) + error_msg("-%c has no effect with -c", 'T'); + if (show_fd_path) + error_msg("-%c has no effect with -c", 'y'); + } + +#ifdef USE_LIBUNWIND + if (stack_trace_enabled) + unwind_init(); +#endif + /* See if they want to run as another user. */ if (username != NULL) { struct passwd *pent;