Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753970AbZLSV7t (ORCPT ); Sat, 19 Dec 2009 16:59:49 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753730AbZLSV7s (ORCPT ); Sat, 19 Dec 2009 16:59:48 -0500 Received: from casper.infradead.org ([85.118.1.10]:47735 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753592AbZLSV7r (ORCPT ); Sat, 19 Dec 2009 16:59:47 -0500 Subject: Re: [PATCH 1/1 v2] 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, Arnaldo Carvalho de Melo , =?ISO-8859-1?Q?Fr=E9d=E9ric?= Weisbecker , Mike Galbraith , Paul Mackerras In-Reply-To: <1261257771-10263-1-git-send-email-acme@infradead.org> References: <1261257771-10263-1-git-send-email-acme@infradead.org> Content-Type: text/plain; charset="UTF-8" Date: Sat, 19 Dec 2009 22:59:04 +0100 Message-ID: <1261259944.4314.1.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: 799 Lines: 19 On Sat, 2009-12-19 at 19:22 -0200, Arnaldo Carvalho de Melo wrote: > @@ -422,7 +423,7 @@ static int __cmd_record(int argc __used, const char **argv) > signal(SIGCHLD, sig_handler); > signal(SIGINT, sig_handler); > > - if (pipe(child_ready_pipe) < 0 || pipe(go_pipe) < 0) { > + if (forks && (pipe(child_ready_pipe) < 0 || pipe(go_pipe) < 0)) { > perror("failed to create pipes"); > exit(-1); > } you can avoid this by simply putting the whole thing into the if (forks) thing below. -- 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/