From 4375203e1602acacfc0ef230fd2cabd42d142463 Mon Sep 17 00:00:00 2001 From: Eygene Ryabinkin Date: Fri, 27 Nov 2009 12:35:17 +0300 Subject: [PATCH 1/4] security/vuxml: newentry.sh: install cleanup handler a bit earlier There is a gap between 'mktemp' and installation of the trap handler. We can initialize 'doclean' before trapping signals and additionally check if ${tmp} is empty inside the cleanup handler. This will practically eliminate the gap where temporary file won't be removed if the script will receive some signal. Signed-off-by: Eygene Ryabinkin --- security/vuxml/files/newentry.sh | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/security/vuxml/files/newentry.sh b/security/vuxml/files/newentry.sh index b6337da..d08bbc8 100644 --- a/security/vuxml/files/newentry.sh +++ b/security/vuxml/files/newentry.sh @@ -6,14 +6,14 @@ if [ -z "${vuxml_file}" ]; then exit 1 fi -tmp="`mktemp ${TMPDIR:-/tmp}/vuxml.XXXXXXXXXX`" || exit 1 -doclean="yes" cleanup() { if [ "${doclean}" = "yes" ]; then - rm -f "${tmp}" + [ -n "${tmp}" ] && rm -f "${tmp}" fi } +doclean="yes" trap cleanup EXIT 1 2 13 15 +tmp="`mktemp ${TMPDIR:-/tmp}/vuxml.XXXXXXXXXX`" || exit 1 vid="`uuidgen | tr '[:upper:]' '[:lower:]'`" [ -z "$vid" ] && exit 1 -- 1.6.5.3