]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
start: log closing cmd socket and STOPPED state
authorChristian Brauner <christian.brauner@ubuntu.com>
Sat, 16 Dec 2017 13:39:12 +0000 (14:39 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Tue, 2 Jan 2018 00:01:19 +0000 (01:01 +0100)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/start.c

index 22412542cbab06017a0054dbc181e6c9e826e44a..0814cacc72c36afe5a369f908c9ce7bf262a18f4 100644 (file)
@@ -762,12 +762,19 @@ void lxc_fini(const char *name, struct lxc_handler *handler)
         */
        close(handler->conf->maincmd_fd);
        handler->conf->maincmd_fd = -1;
+       TRACE("Closed command socket");
 
-       /* This function will try to connect to the legacy lxc-monitord state
-        * server and only exists for backwards compatibility.
+       /* This function will try to connect to the legacy lxc-monitord
+        * state server and only exists for backwards compatibility.
         */
        lxc_monitor_send_state(name, STOPPED, handler->lxcpath);
 
+       /* The command socket is closed so no one can acces the command
+        * socket anymore so there's no need to lock it.
+        */
+       handler->state = STOPPED;
+       TRACE("Set container state to \"STOPPED\"");
+
        if (run_lxc_hooks(name, "post-stop", handler->conf, handler->lxcpath, NULL)) {
                ERROR("Failed to run lxc.hook.post-stop for container \"%s\".", name);
                if (handler->conf->reboot) {