Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932962AbZLRVaW (ORCPT ); Fri, 18 Dec 2009 16:30:22 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S932735AbZLRVaR (ORCPT ); Fri, 18 Dec 2009 16:30:17 -0500 Received: from casper.infradead.org ([85.118.1.10]:35620 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932717AbZLRVaO (ORCPT ); Fri, 18 Dec 2009 16:30:14 -0500 Subject: Re: [PATCH 1/1] perf record: We should fork only if a program was specified to run From: Peter Zijlstra To: Arnaldo Carvalho de Melo Cc: Ingo Molnar , linux-kernel@vger.kernel.org, =?ISO-8859-1?Q?Fr=E9d=E9ric?= Weisbecker , Mike Galbraith , Paul Mackerras In-Reply-To: <20091218205853.GD19708@ghostprotocols.net> References: <1261168944-6615-1-git-send-email-acme@infradead.org> <1261169561.20899.630.camel@laptop> <20091218205853.GD19708@ghostprotocols.net> Content-Type: text/plain; charset="UTF-8" Date: Fri, 18 Dec 2009 22:29:50 +0100 Message-ID: <1261171790.20899.675.camel@laptop> Mime-Version: 1.0 X-Mailer: Evolution 2.28.1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 800 Lines: 20 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/