[CRIU]
[PATCH 6/8] parasite: Make set_logfd, fini to handle statuses
Cyrill Gorcunov
gorcunov at openvz.org
Tue Feb 21 15:22:16 EST 2012
The caller code already provides status argument,
we simply didn't use it. So it was a bug.
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
include/parasite.h | 1 +
parasite.c | 23 ++++++++++++++++++-----
2 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/include/parasite.h b/include/parasite.h
index 181cf7c..adb708d 100644
--- a/include/parasite.h
+++ b/include/parasite.h
@@ -31,6 +31,7 @@
#define PARASITE_ERR_SOCKET -1034
#define PARASITE_ERR_BIND -1035
#define PARASITE_ERR_SIGPROCMASK -1036
+#define PARASITE_ERR_RECVFD -1037
enum {
PARASITE_CMD_PINGME,
diff --git a/parasite.c b/parasite.c
index 59e62ea..c8e47fa 100644
--- a/parasite.c
+++ b/parasite.c
@@ -408,18 +408,31 @@ err:
return ret;
}
-static int set_logfd(void)
+static int set_logfd(parasite_status_t *st)
{
+ int ret = -1;
+
logfd = recv_fd(tsock);
- return logfd;
+ if (logfd < 0) {
+ SET_PARASITE_STATUS(st, PARASITE_ERR_RECVFD, logfd);
+ goto err;
+ } else
+ ret = 0;
+
+ SET_PARASITE_STATUS_SUCCESS(st);
+err:
+ return ret;
}
-static int fini(void)
+static int fini(parasite_status_t *st)
{
if (reset_blocked == 1)
sys_sigprocmask(SIG_SETMASK, &old_blocked, NULL);
+
sys_close(logfd);
sys_close(tsock);
+
+ SET_PARASITE_STATUS_SUCCESS(st);
return 0;
}
@@ -437,9 +450,9 @@ static int __used parasite_service(unsigned long cmd, void *args, void *brk)
case PARASITE_CMD_INIT:
return init((struct parasite_init_args *) args);
case PARASITE_CMD_FINI:
- return fini();
+ return fini((parasite_status_t *)args);
case PARASITE_CMD_SET_LOGFD:
- return set_logfd();
+ return set_logfd((parasite_status_t *)args);
case PARASITE_CMD_DUMPPAGES_INIT:
return dump_pages_init((parasite_status_t *) args);
case PARASITE_CMD_DUMPPAGES_FINI:
--
1.7.7.6
More information about the CRIU
mailing list