[4/4] RPC: Evaluate configuration file before switching to RPC mode

Submitted by Adrian Reber on March 20, 2018, 4:55 p.m.

Details

Message ID 20180320165510.13126-5-adrian@lisas.de
State New
Series "Series without cover letter"
Headers show

Commit Message

Adrian Reber March 20, 2018, 4:55 p.m.
From: Adrian Reber <areber@redhat.com>

When CRIU is started in RPC mode ('criu swrk') it used to ignore all
command-line options and configuration files. This moves the jump to RPC
mode after the configuration file parsing to enable configuration.

With this configuration files are now also evaluated in RPC mode and it
is possible to change the behavior of CRIU via the configuration file if
used via RPC.

Signed-off-by: Adrian Reber <areber@redhat.com>
---
 criu/crtools.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

Patch hide | download patch | download mbox

diff --git a/criu/crtools.c b/criu/crtools.c
index e4f866dd7..d345d129b 100644
--- a/criu/crtools.c
+++ b/criu/crtools.c
@@ -565,19 +565,6 @@  int main(int argc, char *argv[], char *envp[])
 	if (kerndat_init())
 		return 1;
 
-	if (!strcmp(argv[1], "swrk")) {
-		if (argc < 3)
-			goto usage;
-		/*
-		 * This is to start criu service worker from libcriu calls.
-		 * The usage is "criu swrk <fd>" and is not for CLI/scripts.
-		 * The arguments semantics can change at any time with the
-		 * corresponding lib call change.
-		 */
-		opts.swrk_restore = true;
-		return cr_service_work(atoi(argv[2]));
-	}
-
 	help_or_configs = passed_help_or_defaults_forbidden(argc, argv);
 	if (help_or_configs == 1) {
 		usage_error = false;
@@ -906,6 +893,19 @@  int main(int argc, char *argv[], char *envp[])
 		}
 	}
 
+	if (!strcmp(argv[1], "swrk")) {
+		if (argc < 3)
+			goto usage;
+		/*
+		 * This is to start criu service worker from libcriu calls.
+		 * The usage is "criu swrk <fd>" and is not for CLI/scripts.
+		 * The arguments semantics can change at any time with the
+		 * corresponding lib call change.
+		 */
+		opts.swrk_restore = true;
+		return cr_service_work(atoi(argv[2]));
+	}
+
 	if (opts.deprecated_ok)
 		pr_msg("Turn deprecated stuff ON\n");
 	if (opts.tcp_skip_in_flight)