CRIU can get confused if more than one c/r is done in the same directory, so we
should require lxcapi so that it refuses to dump to a directory with criu
images already in it.

This won't help if the user copies a checkpoint over another, but at least the
common case will be caught.

Signed-off-by: Tycho Andersen <[email protected]>
---
 src/lxc/lxccontainer.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c
index dbcee99..4a290f1 100644
--- a/src/lxc/lxccontainer.c
+++ b/src/lxc/lxccontainer.c
@@ -3687,8 +3687,13 @@ static bool do_lxcapi_checkpoint(struct lxc_container 
*c, char *directory, bool
        if (!criu_ok(c))
                return false;
 
-       if (mkdir(directory, 0700) < 0 && errno != EEXIST)
+       if (mkdir(directory, 0700) < 0) {
+               if (errno == EEXIST)
+                       ERROR("please use a new directory for criu state");
+               else
+                       SYSERROR("mkdir failed");
                return false;
+       }
 
        if (!dump_net_info(c, directory))
                return false;
-- 
2.1.4

_______________________________________________
lxc-devel mailing list
[email protected]
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to