From: Randy Dunlap Date: Mon, 14 Jan 2008 23:18:31 +0000 (-0800) Subject: kbuild: minor scripts/decodecode update X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=fa220d89ad050cf5d970c0418ded019a80efedfb;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 Signed-off-by: Sam Ravnborg --- diff --git a/scripts/decodecode b/scripts/decodecode index 1e1a8f620c47..235d3938529d 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