From: David McCullough Date: Tue, 2 Jun 2009 00:09:46 +0000 (+0000) Subject: Rather than putting the `rm` at the end of the script before the normal X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=b93b5fe27c2ca8f7f8e6f28b6cf205578c1b3518;p=elf2flt.git Rather than putting the `rm` at the end of the script before the normal exit point, create a trap to automatically delete the script when exiting. This way the linker script gets cleaned up whenever there is an error as well. Otherwise every link invocation that ends in a failure could leave behind crap. On my system, i found almost 2 million of these suckers in my /tmp dir. Signed-off-by: Mike Frysinger --- diff --git a/ld-elf2flt.in b/ld-elf2flt.in index 32eb7e0..91e1ccb 100644 --- a/ld-elf2flt.in +++ b/ld-elf2flt.in @@ -107,6 +107,7 @@ then [ "$VERBOSE" = "y" ] && set -x ARG1="$ARG1 $FINAL_ONLY" NEWLDSCRIPT=`mktemp /tmp/flt-XXXXXX` + trap 'rm -f "$NEWLDSCRIPT"' EXIT SEDOP=" -e s/^R_RODAT// -e /^W_RODAT/d" OBJCOPYOP="" if [ "$MOVDAT" ] @@ -225,7 +226,6 @@ then fi fi [ "$RFILE" = "$OFILE.gdb" ] || rm -f "$RFILE" # not needed for any reason - rm -f "$NEWLDSCRIPT" exit 0 fi