summaryrefslogtreecommitdiffstats
path: root/scripts/decodecode
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2008-01-31 11:25:51 +1100
committerPaul Mackerras <paulus@samba.org>2008-01-31 11:25:51 +1100
commitbd45ac0c5daae35e7c71138172e63df5cf644cf6 (patch)
tree5eb5a599bf6a9d7a8a34e802db932aa9e9555de4 /scripts/decodecode
parent4eece4ccf997c0e6d8fdad3d842e37b16b8d705f (diff)
parent5bdeae46be6dfe9efa44a548bd622af325f4bdb4 (diff)
Merge branch 'linux-2.6'
Diffstat (limited to 'scripts/decodecode')
-rw-r--r--scripts/decodecode17
1 files changed, 15 insertions, 2 deletions
diff --git a/scripts/decodecode b/scripts/decodecode
index 1e1a8f620c4..235d3938529 100644
--- a/scripts/decodecode
+++ b/scripts/decodecode
@@ -6,7 +6,19 @@
# e.g., to decode an i386 oops on an x86_64 system, use:
# AFLAGS=--32 decodecode < 386.oops
-T=`mktemp`
+cleanup() {
+ rm -f $T $T.s $T.o
+ exit 1
+}
+
+die() {
+ echo "$@"
+ exit 1
+}
+
+trap cleanup EXIT
+
+T=`mktemp` || die "cannot create temp file"
code=
while read i ; do
@@ -20,6 +32,7 @@ esac
done
if [ -z "$code" ]; then
+ rm $T
exit
fi
@@ -48,4 +61,4 @@ echo -n " .byte 0x" > $T.s
echo $code >> $T.s
as $AFLAGS -o $T.o $T.s
objdump -S $T.o
-rm $T.o $T.s
+rm $T $T.s $T.o