lkml.org 
[lkml]   [2015]   [May]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 08/10] merge_config.sh: use trap for cleanup
Date
Use the trap to cleanup even on regular exit.

Signed-off-by: Olof Johansson <olof@lixom.net>
---
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
--
1.7.10.4


\
 
 \ /
  Last update: 2015-05-21 00:21    [W:0.048 / U:0.560 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site