Commit 59c2d406 by Tycho Andersen Committed by Stéphane Graber

c/r: remember to clean up pidfile

When restoring, we didn't clean up the pidfile that criu uses to pass us the init pid on error or success; let's do that. Signed-off-by: 's avatarTycho Andersen <tycho.andersen@canonical.com> Acked-by: 's avatarSerge E. Hallyn <serge.hallyn@ubuntu.com>
parent d24095e4
......@@ -527,6 +527,9 @@ void do_restore(struct lxc_container *c, int pipe, char *directory, bool verbose
ret = fscanf(f, "%d", (int*) &handler->pid);
fclose(f);
if (unlink(pidfile) < 0 && errno != ENOENT)
SYSERROR("unlinking pidfile failed");
if (ret != 1) {
ERROR("reading restore pid failed");
goto out_fini_handler;
......@@ -557,6 +560,8 @@ void do_restore(struct lxc_container *c, int pipe, char *directory, bool verbose
out_fini_handler:
lxc_fini(c->name, handler);
if (unlink(pidfile) < 0 && errno != ENOENT)
SYSERROR("unlinking pidfile failed");
out:
if (pipe >= 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment