]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
nspawn: fix exit code for --help and --version (#4609)
authorMartin Pitt <martin.pitt@ubuntu.com>
Tue, 8 Nov 2016 04:31:55 +0000 (05:31 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 8 Nov 2016 04:31:55 +0000 (23:31 -0500)
Commit b006762 inverted the initial exit code which is relevant for --help and
--version without a particular reason.  For these special options, parse_argv()
returns 0 so that our main() immediately skips to the end without adjusting
"ret". Otherwise, if an actual container is being started, ret is set on error
in run(), which still provides the "non-zero exit on error" behaviour.

Fixes #4605.

src/nspawn/nspawn.c

index 673e61691195fde8d2dfb456779c74159c0480f8..1563644e4b112651edf216f4c7e8f1d6e3f0d5ef 100644 (file)
@@ -4033,7 +4033,7 @@ int main(int argc, char *argv[]) {
         bool root_device_rw = true, home_device_rw = true, srv_device_rw = true;
         _cleanup_close_ int master = -1, image_fd = -1;
         _cleanup_fdset_free_ FDSet *fds = NULL;
-        int r, n_fd_passed, loop_nr = -1, ret = EXIT_FAILURE;
+        int r, n_fd_passed, loop_nr = -1, ret = EXIT_SUCCESS;
         char veth_name[IFNAMSIZ] = "";
         bool secondary = false, remove_subvol = false;
         pid_t pid = 0;