lkml.org 
[lkml]   [2011]   [Sep]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/2] merge_config.sh: trap signals and clean up
Date
The script creates a temp file, but doesn't ensure that it cleans up after
itself in the event of a signal.

Trap SIGHUP SIGINT and SIGTERM and remove the temp file.

Signed-off-by: Darren Hart <dvhart@linux.intel.com>
---
scripts/kconfig/merge_config.sh | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/scripts/kconfig/merge_config.sh b/scripts/kconfig/merge_config.sh
index a644724..a4b1bad 100755
--- a/scripts/kconfig/merge_config.sh
+++ b/scripts/kconfig/merge_config.sh
@@ -20,11 +20,15 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.

-MERGE_LIST=$*
+clean_up() {
+ rm -f $TMP_FILE
+ exit
+}

+trap clean_up SIGHUP SIGINT SIGTERM

+MERGE_LIST=$*
TMP_FILE=$(mktemp ./.tmp.config.XXXXXXXXXX)
-
SED_CONFIG_EXP="s/^\(# \)\{0,1\}\(CONFIG_[a-zA-Z0-9_]*\)[= ].*/\2/p"

# Merge files, printing warnings on overrided values
@@ -65,5 +69,4 @@ for CFG in `sed -n "$SED_CONFIG_EXP" $TMP_FILE`; do
fi
done

-# Cleanup
-rm $TMP_FILE
+clean_up
--
1.7.6.2


\
 
 \ /
  Last update: 2011-09-27 05:29    [W:0.071 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site