From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= Subject: [PATCH kvm-unit-tests v2 04/12] scripts/mkstandalone: improve exit paths Date: Thu, 17 Dec 2015 18:53:35 +0100 Message-ID: <1450374823-7648-5-git-send-email-rkrcmar@redhat.com> References: <1450374823-7648-1-git-send-email-rkrcmar@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Paolo Bonzini , Andrew Jones To: kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:56567 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753487AbbLQRyH (ORCPT ); Thu, 17 Dec 2015 12:54:07 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 2B33BA3D2D for ; Thu, 17 Dec 2015 17:54:07 +0000 (UTC) In-Reply-To: <1450374823-7648-1-git-send-email-rkrcmar@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: trap can be called on EXIT, which covers most exits. Signed-off-by: Radim Kr=C4=8Dm=C3=A1=C5=99 --- v2: new =20 scripts/mkstandalone.sh | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/scripts/mkstandalone.sh b/scripts/mkstandalone.sh index cf2182dbd936..778383077769 100755 --- a/scripts/mkstandalone.sh +++ b/scripts/mkstandalone.sh @@ -71,7 +71,7 @@ exit 1 EOF else cat <> $standalone -trap 'rm -f \$bin; exit 1' HUP INT TERM +trap 'rm -f \$bin' EXIT bin=3D\`mktemp\` base64 -d << 'BIN_EOF' | zcat > \$bin && EOF @@ -107,10 +107,7 @@ __run() __eval_log() { eval "\${@}"; } =20 run `escape "${@}"` -ret=3D$? - -rm -f \$bin -exit \$ret +exit \$? EOF fi chmod +x $standalone --=20 2.6.4