Improve compiler temporary directory management

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@3339 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2006-01-21 00:13:02 +00:00
parent cf3789e35d
commit debd0ea476

View File

@ -63,6 +63,7 @@ fatal_error() # $* = Error Message
echo " ERROR: $@" >&2
if [ $COMMAND = check -o $COMMAND = compile ]; then
[ -n "$TMP_DIR" ] && rm -rf $TMP_DIR
[ -n "$TMP_DIR1" ] && rm -rf $TMP_DIR1
[ -n "$RESTOREBASE" ] && rm -f $RESTOREBASE
else
stop_firewall
@ -79,6 +80,7 @@ startup_error() # $* = Error Message
echo " ERROR: $@" >&2
my_mutex_off
[ -n "$TMP_DIR" ] && rm -rf $TMP_DIR
[ -n "$TMP_DIR1" ] && rm -rf $TMP_DIR1
[ -n "$RESTOREBASE" ] && rm -f $RESTOREBASE
kill $$
exit 2
@ -2197,6 +2199,8 @@ stop_firewall() {
logger "Shorewall Stopped"
rm -rf $TMP_DIR
[ -n "$TMP_DIR1" ] && rm -rf $TMP_DIR1
case $COMMAND in
stop|clear)
@ -9422,9 +9426,9 @@ compile_firewall() # $1 = File Name
RESTOREBASE=$(mktempfile /tmp)
STATEDIR=/tmp/$USER/.compiler
STATEDIR=$(mktempdir)
[ -d $STATEDIR ] || mkdir -p $STATEDIR
TMP_DIR1=$STATEDIR
[ -n "$RESTOREBASE" ] || startup_error "Cannot create temporary file in /tmp"
@ -9695,6 +9699,8 @@ __EOF__
echo "Shorewall configuration compiled to $outfile"
rm -rf $TMP_DIR
rm -rf $TMP_DIR1
}
#