From: Danil Osherov Date: Thu, 24 Dec 2015 13:54:19 +0000 (+0300) Subject: python-lxc: Call PyOS_AfterFork after attaching to a container X-Git-Tag: lxc-2.0.0.beta2~77^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F739%2Fhead;p=thirdparty%2Flxc.git python-lxc: Call PyOS_AfterFork after attaching to a container As lxc_attach() calls fork() PyOS_AfterFork should be called in the new process if the Python interpreter will continue to be used. Signed-off-by: Danil Osherov --- diff --git a/src/python-lxc/lxc.c b/src/python-lxc/lxc.c index b4698ad70..151d8faa1 100644 --- a/src/python-lxc/lxc.c +++ b/src/python-lxc/lxc.c @@ -117,6 +117,12 @@ struct lxc_attach_python_payload { static int lxc_attach_python_exec(void* _payload) { + /* This function is the first one to be called after attaching to a + * container. As lxc_attach() calls fork() PyOS_AfterFork should be called + * in the new process if the Python interpreter will continue to be used. + */ + PyOS_AfterFork(); + struct lxc_attach_python_payload *payload = (struct lxc_attach_python_payload *)_payload; PyObject *result = PyObject_CallFunctionObjArgs(payload->fn,