]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
python-lxc: Call PyOS_AfterFork after attaching to a container 739/head
authorDanil Osherov <shindo@yandex-team.ru>
Thu, 24 Dec 2015 13:54:19 +0000 (16:54 +0300)
committerDanil Osherov <shindo@yandex-team.ru>
Thu, 24 Dec 2015 14:00:54 +0000 (17:00 +0300)
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 <shindo@yandex-team.ru>
src/python-lxc/lxc.c

index b4698ad7081f110608e0f055ea712fd6c2d90080..151d8faa1776575727cbf67ede0deafefe8f0709 100644 (file)
@@ -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,