From: Darren Hart <dvhart@linux.intel.com>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Cc: John Stultz <johnstul@us.ibm.com>, Darren Hart <dvhart@linux.intel.com>
Subject: [PATCH 2/2] merge_config.sh: trap signals and clean up
Date: Mon, 26 Sep 2011 20:25:49 -0700 [thread overview]
Message-ID: <7332e875ca5e32e7c956591c931a8c2c0ed8f7b1.1317093857.git.dvhart@linux.intel.com> (raw)
In-Reply-To: <1317093949-20219-1-git-send-email-dvhart@linux.intel.com>
In-Reply-To: <a3c278930a1995e5c78486a20763a1ec780f63c4.1317093857.git.dvhart@linux.intel.com>
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
next prev parent reply other threads:[~2011-09-27 3:25 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-21 5:22 [PATCH] kconfig: Add merge_config.sh script John Stultz
2011-09-21 6:44 ` Richard Cochran
2011-09-21 15:18 ` John Stultz
2011-09-21 15:28 ` Darren Hart
2011-09-22 20:05 ` Sam Ravnborg
2011-09-21 12:10 ` Michal Marek
2011-09-21 15:36 ` John Stultz
2011-09-21 21:42 ` Dmitry Fink (Palm GBU)
2011-09-22 1:20 ` Dmitry Fink (Palm GBU)
2011-09-22 16:18 ` Arnaud Lacombe
2011-09-27 3:25 ` Darren Hart
2011-09-27 3:25 ` [PATCH 1/2] merge_config.sh: do not print non-matching lines in the sed expressions Darren Hart
2011-09-27 3:25 ` Darren Hart [this message]
2011-09-27 3:30 ` Darren Hart
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7332e875ca5e32e7c956591c931a8c2c0ed8f7b1.1317093857.git.dvhart@linux.intel.com \
--to=dvhart@linux.intel.com \
--cc=johnstul@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®