]> git.proxmox.com Git - mirror_lxc.git/commit
daemon: fix the wrong pid in daemon model
authorQiang Huang <h.huangqiang@huawei.com>
Wed, 22 Jan 2014 04:11:38 +0000 (12:11 +0800)
committerStéphane Graber <stgraber@ubuntu.com>
Thu, 23 Jan 2014 00:53:22 +0000 (19:53 -0500)
commit6eaac3034e8c19eab2b91e201628c4ab5a85a085
tree103e2601376dcde7f7f8f3fec74b43050c4cf9a4
parent72cf75fa33b97104c5e9905aab1be8d335119e7b
daemon: fix the wrong pid in daemon model

When you start a container in daemon model, you have at least
3 processes:
 1. The command the user start (lxc-start -d)
 2. The backgrounded fork of that command after start() is done
 3. The container init process

In PID file, we need (2), but currently we are writing (1),
this is wrong because (1) exits as soon as the container is
started, it's complately useless.

So we write pid after daemonize, so that we'll always write
the right pid to PID file.

Reported-by: Stephane Graber <stgraber@ubuntu.com>
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
src/lxc/lxc_start.c
src/lxc/lxccontainer.c