lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 26 Sep 2011 20:25:49 -0700
From:	Darren Hart <dvhart@...ux.intel.com>
To:	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Cc:	John Stultz <johnstul@...ibm.com>,
	Darren Hart <dvhart@...ux.intel.com>
Subject: [PATCH 2/2] merge_config.sh: trap signals and clean up

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@...ux.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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists