aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorRandy Dunlap <randy.dunlap@oracle.com>2008-01-14 18:18:31 -0500
committerSam Ravnborg <sam@ravnborg.org>2008-01-28 17:14:40 -0500
commitfa220d89ad050cf5d970c0418ded019a80efedfb (patch)
tree6148ecb571839fbc253582f86d4c7f9161b1e7d7 /scripts
parent80daa56008dad44f08d0b47670cf2513aa98ab53 (diff)
kbuild: minor scripts/decodecode update
Remove the tmp file when exiting. Noticed by Arjan van de Ven. Catch mktemp failure and exit with message. Trap kill or other signals and exit cleanly. Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/decodecode17
1 files changed, 15 insertions, 2 deletions
diff --git a/scripts/decodecode b/scripts/decodecode
index 1e1a8f620c47..235d3938529d 100644
--- a/scripts/decodecode
+++ b/scripts/decodecode
@@ -6,7 +6,19 @@
6# e.g., to decode an i386 oops on an x86_64 system, use: 6# e.g., to decode an i386 oops on an x86_64 system, use:
7# AFLAGS=--32 decodecode < 386.oops 7# AFLAGS=--32 decodecode < 386.oops
8 8
9T=`mktemp` 9cleanup() {
10 rm -f $T $T.s $T.o
11 exit 1
12}
13
14die() {
15 echo "$@"
16 exit 1
17}
18
19trap cleanup EXIT
20
21T=`mktemp` || die "cannot create temp file"
10code= 22code=
11 23
12while read i ; do 24while read i ; do
@@ -20,6 +32,7 @@ esac
20done 32done
21 33
22if [ -z "$code" ]; then 34if [ -z "$code" ]; then
35 rm $T
23 exit 36 exit
24fi 37fi
25 38
@@ -48,4 +61,4 @@ echo -n " .byte 0x" > $T.s
48echo $code >> $T.s 61echo $code >> $T.s
49as $AFLAGS -o $T.o $T.s 62as $AFLAGS -o $T.o $T.s
50objdump -S $T.o 63objdump -S $T.o
51rm $T.o $T.s 64rm $T $T.s $T.o