[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20080114151831.a5ff7d7a.randy.dunlap@oracle.com>
Date: Mon, 14 Jan 2008 15:18:31 -0800
From: Randy Dunlap <randy.dunlap@...cle.com>
To: lkml <linux-kernel@...r.kernel.org>
Cc: akpm <akpm@...ux-foundation.org>, samr <sam@...nborg.org>
Subject: [PATCH] scripts: minor decodecode update
From: Randy Dunlap <randy.dunlap@...cle.com>
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@...cle.com>
---
scripts/decodecode | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
--- linux-2.6.24-rc7.orig/scripts/decodecode
+++ linux-2.6.24-rc7/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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists