[CRIU] [PATCH 2/3] crtools: fix exit code for page-server
Andrei Vagin
avagin at openvz.org
Tue Jan 10 13:21:44 PST 2017
From: Andrei Vagin <avagin at virtuozzo.com>
cr_page_server() returns pid, if it is executed as a daemon
otherwise it returns an error code.
crtools returns 0 only if cr_page_server() returns a positive value,
what is obviously wrong.
Signed-off-by: Andrei Vagin <avagin at virtuozzo.com>
---
criu/crtools.c | 2 +-
criu/page-xfer.c | 4 +++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/criu/crtools.c b/criu/crtools.c
index 445b3ba..98c755c 100644
--- a/criu/crtools.c
+++ b/criu/crtools.c
@@ -780,7 +780,7 @@ int main(int argc, char *argv[], char *envp[])
#endif
if (!strcmp(argv[optind], "page-server"))
- return cr_page_server(opts.daemon_mode, -1) > 0 ? 0 : 1;
+ return cr_page_server(opts.daemon_mode, -1) != 0;
if (!strcmp(argv[optind], "service"))
return cr_service(opts.daemon_mode);
diff --git a/criu/page-xfer.c b/criu/page-xfer.c
index c95a55f..75d7d07 100644
--- a/criu/page-xfer.c
+++ b/criu/page-xfer.c
@@ -917,7 +917,9 @@ int cr_page_server(bool daemon_mode, int cfd)
return -1;
no_server:
ret = run_tcp_server(daemon_mode, &ask, cfd, sk);
- if (ret != 0)
+ if (ret > 0)
+ return 0;
+ if (ret < 0)
return ret;
if (ask >= 0)
--
2.7.4
More information about the CRIU
mailing list