Re: [uClinux-dev] [PATCH] ld-elf2flt: make sure to cleanup tmp linker script

2009-06-01 Thread David McCullough

Jivin Mike Frysinger lays it down ...
 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 vap...@gentoo.org

Applied,

Thanks,
Davidm


 ---
  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-XX`
 + 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
 uClinux-dev@uclinux.org
 http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
 This message was resent by uclinux-dev@uclinux.org
 To unsubscribe see:
 http://mailman.uclinux.org/mailman/options/uclinux-dev
 

-- 
David McCullough,  david_mccullo...@securecomputing.com,  Ph:+61 734352815
McAfee - SnapGear  http://www.snapgear.comhttp://www.uCdot.org
___
uClinux-dev mailing list
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev


[uClinux-dev] [PATCH] ld-elf2flt: make sure to cleanup tmp linker script

2009-05-29 Thread Mike Frysinger
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 vap...@gentoo.org
---
 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-XX`
+   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
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev