summaryrefslogtreecommitdiffstats
path: root/src/nspawn
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2019-03-21 13:35:45 +0100
committerLennart Poettering <lennart@poettering.net>2019-03-21 16:32:46 +0100
commit44dbef90f1531abd2ba3b47a8ff60833c2dbe64d (patch)
tree36313aad04868238a3bded0916a3a0e6e65fba56 /src/nspawn
parentMerge pull request #12059 from poettering/nspawn-typos (diff)
downloadsystemd-44dbef90f1531abd2ba3b47a8ff60833c2dbe64d.tar.xz
systemd-44dbef90f1531abd2ba3b47a8ff60833c2dbe64d.zip
nspawn: port to main-func.h logic
Diffstat (limited to 'src/nspawn')
-rw-r--r--src/nspawn/nspawn.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index 0cb207528a..95a7d2a5f7 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -57,6 +57,7 @@
#include "loopback-setup.h"
#include "machine-image.h"
#include "macro.h"
+#include "main-func.h"
#include "missing.h"
#include "mkdir.h"
#include "mount-util.h"
@@ -4019,7 +4020,7 @@ static int load_oci_bundle(void) {
return merge_settings(settings, arg_oci_bundle);
}
-static int run(int master,
+static int run_container(int master,
const char* console,
DissectedImage *dissected_image,
bool secondary,
@@ -4607,7 +4608,7 @@ static int initialize_rlimits(void) {
return 0;
}
-int main(int argc, char *argv[]) {
+static int run(int argc, char *argv[]) {
_cleanup_free_ char *console = NULL;
_cleanup_close_ int master = -1;
_cleanup_fdset_free_ FDSet *fds = NULL;
@@ -4964,14 +4965,14 @@ int main(int argc, char *argv[]) {
}
for (;;) {
- r = run(master,
- console,
- dissected_image,
- secondary,
- fds,
- veth_name, &veth_created,
- &exposed,
- &pid, &ret);
+ r = run_container(master,
+ console,
+ dissected_image,
+ secondary,
+ fds,
+ veth_name, &veth_created,
+ &exposed,
+ &pid, &ret);
if (r <= 0)
break;
}
@@ -5062,5 +5063,10 @@ finish:
strv_free(arg_sysctl);
free(arg_slice);
- return r < 0 ? EXIT_FAILURE : ret;
+ if (r < 0)
+ return r;
+
+ return ret;
}
+
+DEFINE_MAIN_FUNCTION_WITH_POSITIVE_FAILURE(run);