From 0709308c1feee5124aad114415cc4a09e6a05e29 Mon Sep 17 00:00:00 2001 From: Axel Beckert Date: Fri, 25 Jan 2013 13:19:36 +0100 Subject: [PATCH] Save exit code $? at the beginning of the END block Otherwise cleaning up by doing some system() calls garbles $? with unwanted values. --- KNOWN_BUGS.markdown | 3 +-- bin/xen-create-image | 7 ++++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/KNOWN_BUGS.markdown b/KNOWN_BUGS.markdown index cacbff5..f3c0278 100644 --- a/KNOWN_BUGS.markdown +++ b/KNOWN_BUGS.markdown @@ -4,8 +4,7 @@ KNOWN BUGS in xen-tools Bugs to fix before next release ------------------------------- -* Exit code of a failed xen-create-image run seems still to be 0, at - least in some cases. +[None so far] Bugs to fix rather soon ----------------------- diff --git a/bin/xen-create-image b/bin/xen-create-image index 4f1bc44..f3e40cd 100755 --- a/bin/xen-create-image +++ b/bin/xen-create-image @@ -4094,7 +4094,10 @@ sub clean_up () { END { - exit 0 if $VERSION || $HELP || $MANUAL || $DUMPCONFIG; + # Capture exit code + my $exitcode = $?; + + exit $exitcode if $VERSION || $HELP || $MANUAL || $DUMPCONFIG; my $host_rsa_key = ''; # @@ -4234,4 +4237,6 @@ END } logprint("\n"); } + + exit $exitcode; } -- 2.39.5