From patchwork Wed Oct 28 00:42:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olof Johansson X-Patchwork-Id: 7505721 Return-Path: X-Original-To: patchwork-linux-kbuild@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 53A58BEEA4 for ; Wed, 28 Oct 2015 00:43:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 876D020898 for ; Wed, 28 Oct 2015 00:43:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B1523208D1 for ; Wed, 28 Oct 2015 00:43:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755024AbbJ1Am5 (ORCPT ); Tue, 27 Oct 2015 20:42:57 -0400 Received: from mail-pa0-f47.google.com ([209.85.220.47]:33372 "EHLO mail-pa0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755000AbbJ1Amz (ORCPT ); Tue, 27 Oct 2015 20:42:55 -0400 Received: by pabla5 with SMTP id la5so44900801pab.0 for ; Tue, 27 Oct 2015 17:42:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lixom_net.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=l9MBcNXnVfTBZ8QdiBDXIkpApdBkgs4Vi5oM+3TDCDM=; b=Vl7P/rKtx70ccTpjDTCF1ZjgpiVe6kyLsXJnUj3xw5lhpaMlC8Y6mInKsXgTXDu5qn hd9LuTlJSwelir6ZBbNYanJJSfOBaTTE9y0lHM1M5NmUrCnGdQJpV7b4R7yCZVlPxR6W YC0JyoyoKsZl/n5wBeMUg4V8lkaaI7KGdPKd+8RjZl1WH5e8cYDgg3g/WbcHLxu8U5zg cY6kJ52KrExvbiy7HRHV3K3o8L1QDfSjowzLiiMMR0ySMJVfBdi/Ov7fSXiIeL/o9nDG RT3I9U5HNsRb+KRIrWS99TP0s55t+fHNJsFDPP2RipQEch4vl+WGV5nOEgY9tGqdXD5j SqJg== 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=l9MBcNXnVfTBZ8QdiBDXIkpApdBkgs4Vi5oM+3TDCDM=; b=YrRH71ZwNnqY7KTR4aBQ0zLKfwYztoq03JQlknaWFQ8JaIAe9IAiaPPmoQTBATo5XA LvCi4kIKPiArxOHzshlv11u3fx0CE+HXueLZt7Gqw3zcqR5DIM1a6GEi406gZg143Hqh NjaKZyM77r1v87UIUFYDakongTbdLGw5rqifK4dCZAmNsao2HNSCbaAUUjC5vxOb7kQY /WnV9ELpye4DWwukmskFxgrpgRUhQs5fwXiptPsHLpMEl6zgaeV2WNupD0u9kTUU2OCQ UsBEzTAaJTfFC4WsPjG8zAuvYpcmZv/c+HCCqZYGTfDDfKZjEIIi58Fb7XPRE9zfrdKR I6ww== X-Gm-Message-State: ALoCoQkdz04XMG5yL7JDcfNUw4/gjmVlcA2UzlWwTObW5zTTpb12w7GP37vFqjL3V1d0V3DHUhzZ X-Received: by 10.69.14.101 with SMTP id ff5mr31391032pbd.70.1445992974739; Tue, 27 Oct 2015 17:42:54 -0700 (PDT) Received: from localhost.localdomain ([58.123.138.250]) by smtp.gmail.com with ESMTPSA id t9sm41801385pbs.17.2015.10.27.17.42.52 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 27 Oct 2015 17:42:53 -0700 (PDT) From: Olof Johansson To: Michal Marek Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, dvhart@linux.intel.com, Olof Johansson Subject: [PATCH 08/10] merge_config.sh: use trap for cleanup Date: Wed, 28 Oct 2015 09:42:09 +0900 Message-Id: <1445992931-28107-9-git-send-email-olof@lixom.net> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1445992931-28107-1-git-send-email-olof@lixom.net> References: <1445992931-28107-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.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,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 Reviewed-by: Darren Hart --- 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 1945b2c..b26c0ef 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 [...]]" @@ -178,4 +180,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