Diff of /perf_examples/task.c [4e98c0] .. [b187c7]  Maximize  Restore

Switch to side-by-side view

--- a/perf_examples/task.c
+++ b/perf_examples/task.c
@@ -185,6 +185,8 @@
 	char buf;
 	pid_t pid;
 
+	go[0] = go[1] = -1;
+
 	if (pfm_initialize() != PFM_SUCCESS)
 		errx(1, "libpfm initialization failed");
 
@@ -282,7 +284,7 @@
 		}
 	}
 
-	if (!options.pid)
+	if (!options.pid && go[1] > -1)
 		close(go[1]);
 
 	if (options.print) {