]> xenbits.xensource.com Git - people/dariof/xen-tools.git/commitdiff
Save exit code $? at the beginning of the END block
authorAxel Beckert <abe@deuxchevaux.org>
Fri, 25 Jan 2013 12:19:36 +0000 (13:19 +0100)
committerAxel Beckert <abe@deuxchevaux.org>
Fri, 25 Jan 2013 12:19:36 +0000 (13:19 +0100)
Otherwise cleaning up by doing some system() calls garbles $? with
unwanted values.

KNOWN_BUGS.markdown
bin/xen-create-image

index cacbff5cd23bdfcd6c5e8460146cf6987b67dbfb..f3c027870f3e525a7e0cc732289fc05613aca952 100644 (file)
@@ -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
 -----------------------
index 4f1bc44e1de225eb4ffb1efb720068eb9dcf494f..f3e40cd2f66bae45eac3bbf4de34f8164ddb6386 100755 (executable)
@@ -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;
 }