Blob Blame History Raw
Index: strace-4.12/strace.1
===================================================================
--- strace-4.12.orig/strace.1	2016-05-26 17:34:28.000000000 +0200
+++ strace-4.12/strace.1	2018-04-30 13:08:34.770163287 +0200
@@ -601,10 +601,13 @@
 is used.
 .LP
 When using
-.BR \-p ,
+.B \-p
+without a
+.IR command ,
 the exit status of
 .B strace
-is zero unless there was an unexpected error in doing the tracing.
+is zero unless no processes has been attached or there was an unexpected error
+in doing the tracing.
 .SH "SETUID INSTALLATION"
 If
 .B strace
Index: strace-4.12/strace.c
===================================================================
--- strace-4.12.orig/strace.c	2018-04-30 13:07:36.776730188 +0200
+++ strace-4.12/strace.c	2018-04-30 13:08:34.771163277 +0200
@@ -138,7 +138,7 @@
 /* Are we "strace PROG" and need to hide everything until execve? */
 bool hide_log_until_execve = 0;
 
-static int exit_code = 0;
+static int exit_code;
 static int strace_child = 0;
 static int strace_tracer_pid = 0;
 
@@ -2446,6 +2446,8 @@
 {
 	init(argc, argv);
 
+	exit_code = !nprocs;
+
 	while (trace())
 		;