Re: [PATCH 1/1] perf record: We should fork only if a program wasspecified to run

From: Peter Zijlstra
Date: Fri Dec 18 2009 - 16:30:25 EST


On Fri, 2009-12-18 at 18:58 -0200, Arnaldo Carvalho de Melo wrote:
> > > - if (pipe(child_ready_pipe) < 0 || pipe(go_pipe) < 0) {
> > > + if (target_pid == -1 && argc > 0 &&
> > > + (pipe(child_ready_pipe) < 0 || pipe(go_pipe) < 0)) {
> > > perror("failed to create pipes");
> > > exit(-1);
> > > }

Also, there's an unconditional close() a bit further down.

If not for that, I'd have put the whole mkpipe thing in the if
(target_pid == -1) branch.

Maybe I shouldn't have skimped on the extra state for that close

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/