From: Tycho Andersen Date: Tue, 2 Jun 2015 03:14:57 +0000 (-0600) Subject: c/r: remember to clean up pidfile X-Git-Tag: lxc-1.1.3~61 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=02f3244fcdec0255597ba2a077e73c9512c5900a;p=thirdparty%2Flxc.git 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: Tycho Andersen Acked-by: Serge E. Hallyn --- diff --git a/src/lxc/criu.c b/src/lxc/criu.c index 5fbe7cbad..c331adf7f 100644 --- a/src/lxc/criu.c +++ b/src/lxc/criu.c @@ -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) {