From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755038AbbJ1Am7 (ORCPT ); Tue, 27 Oct 2015 20:42:59 -0400 Received: from mail-pa0-f49.google.com ([209.85.220.49]:36291 "EHLO mail-pa0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755001AbbJ1Amz (ORCPT ); Tue, 27 Oct 2015 20:42:55 -0400 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-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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 -- 2.1.4