summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry V. Levin <ldv@altlinux.org>2014-06-03 13:20:05 +0000
committerDmitry V. Levin <ldv@altlinux.org>2014-06-03 13:20:05 +0000
commit2727aae37c56eb2620699388513ef5bbb0af2b7e (patch)
tree53d93a79d4e0fe2970acb24098821556223aa6e9
parent4182981f6d025d8e753f3da635df5832c0c6d99d (diff)
downloadstrace-2727aae37c56eb2620699388513ef5bbb0af2b7e.tar.gz
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.
-rw-r--r--strace.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/strace.c b/strace.c
index fe197e5d3..46c9d63ef 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;