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 <[email protected]>
---
 ld-elf2flt.in |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

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
 
-- 
1.6.3.1

_______________________________________________
uClinux-dev mailing list
[email protected]
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by [email protected]
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev

Reply via email to