From patchwork Wed May 20 22:00:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olof Johansson X-Patchwork-Id: 6450381 Return-Path: X-Original-To: patchwork-linux-kbuild@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 31CB49F1C1 for ; Wed, 20 May 2015 22:03:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6C28B2020F for ; Wed, 20 May 2015 22:03:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7BB8A203B0 for ; Wed, 20 May 2015 22:03:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754333AbbETWC4 (ORCPT ); Wed, 20 May 2015 18:02:56 -0400 Received: from mail-pd0-f180.google.com ([209.85.192.180]:33174 "EHLO mail-pd0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754070AbbETWCn (ORCPT ); Wed, 20 May 2015 18:02:43 -0400 Received: by pdbqa5 with SMTP id qa5so83658083pdb.0 for ; Wed, 20 May 2015 15:02:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=lNfbcLX0CvyPCLwp7kFk6eRH4fBaIcJiZXB9AJRJEuo=; b=Ex1OT0Qrr+q//YPVHCKLEYD+GTTqdZqDulwq5v1zlOBMigaFaFCDQfB6c9GUTNnU/6 5nRmdIQDx8+Jq/3yIPsUyKJDVLzqGFz8wddBG4JXhd1JlrYD2Uf2NzBGePtLcSvy9UEE SChOqSVE1BMeNwPBDSD0n6938aZgJXrzWiXHReQsqM40LrwWJG2BjUXlCStEAyvmyA5G PHrybX18mofbCkss+St6Ig1V1eohEq5Dx1m8snbMvc2+EMdAlWPFhLbPCjKvarnFskvm fK2nf1D99mQXQDs89YqYcC5gOUk3v9KvecGD0REJ5gUpZPuvfE74/tuml4tSM+rXdr67 SZFQ== X-Gm-Message-State: ALoCoQlhNxw6BoBHMT3mOK5HZmGB8mZ/VWGa4CnF0KJ90WqCw2ryMulkZydK2sfStuQpG1CLh56W X-Received: by 10.70.0.67 with SMTP id 3mr67060689pdc.152.1432159363076; Wed, 20 May 2015 15:02:43 -0700 (PDT) Received: from brutus.lixom.net (173-13-129-225-sfba.hfc.comcastbusiness.net. [173.13.129.225]) by mx.google.com with ESMTPSA id ux6sm17193507pab.24.2015.05.20.15.02.41 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 May 2015 15:02:42 -0700 (PDT) From: Olof Johansson To: yann.morin.1998@free.fr Cc: linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, dvhart@linux.intel.com, john.stultz@linaro.org, jwboyer@redhat.com, Olof Johansson Subject: [PATCH 08/10] merge_config.sh: use trap for cleanup Date: Wed, 20 May 2015 15:00:58 -0700 Message-Id: <1432159260-39390-9-git-send-email-olof@lixom.net> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1432159260-39390-1-git-send-email-olof@lixom.net> References: <1432159260-39390-1-git-send-email-olof@lixom.net> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use the trap to cleanup even on regular exit. Signed-off-by: Olof Johansson --- scripts/kconfig/merge_config.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/kconfig/merge_config.sh b/scripts/kconfig/merge_config.sh index 932fd52..fd27294 100755 --- a/scripts/kconfig/merge_config.sh +++ b/scripts/kconfig/merge_config.sh @@ -23,10 +23,12 @@ EXITVAL=0 clean_up() { - rm -f $TMP_FILE + if [ -n "$CLEAN_FILES" ] ; then + rm -f $CLEAN_FILES + fi exit $EXITVAL } -trap clean_up HUP INT TERM +trap clean_up HUP INT TERM EXIT usage() { echo "Usage: $0 [OPTIONS] [CONFIG [...]]" @@ -166,4 +168,4 @@ for CFG in $(sed -n "$SED_CONFIG_EXP" $TMP_FILE); do fi >&2 done -clean_up +# Note: clean_up will run here due to EXIT being trapped