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 fe197e5..46c9d63 100644
--- a/strace.c
+++ b/strace.c
@@ -1817,11 +1817,6 @@
 		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 @@
 		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;