X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fpython.c;h=5669f45a1806dce01871f6813e3d8e9cb1850818;hb=8f6aa6970bf787e6a11e095322af3338ec781d78;hp=64db6985ad4fa301663058c935794c9c73ba8a3a;hpb=ec51ddee94fa2ba1e01fe0e336ccc9c190a198ff;p=collectd.git diff --git a/src/python.c b/src/python.c index 64db6985..5669f45a 100644 --- a/src/python.c +++ b/src/python.c @@ -31,7 +31,7 @@ #include "collectd.h" -#include "common.h" +#include "utils/common/common.h" #include "cpython.h" @@ -285,7 +285,7 @@ static void cpy_build_name(char *buf, size_t size, PyObject *callback, PyObject *mod = NULL; if (name != NULL) { - snprintf(buf, size, "python.%s", name); + ssnprintf(buf, size, "python.%s", name); return; } @@ -294,14 +294,14 @@ static void cpy_build_name(char *buf, size_t size, PyObject *callback, module = cpy_unicode_or_bytes_to_string(&mod); if (module != NULL) { - snprintf(buf, size, "python.%s", module); + ssnprintf(buf, size, "python.%s", module); Py_XDECREF(mod); PyErr_Clear(); return; } Py_XDECREF(mod); - snprintf(buf, size, "python.%p", callback); + ssnprintf(buf, size, "python.%p", callback); PyErr_Clear(); } @@ -367,7 +367,7 @@ void cpy_log_exception(const char *context) { continue; if (cpy[strlen(cpy) - 1] == '\n') - cpy[strlen(cpy) - 1] = 0; + cpy[strlen(cpy) - 1] = '\0'; Py_BEGIN_ALLOW_THREADS; ERROR("%s", cpy); @@ -1133,7 +1133,11 @@ static void *cpy_interactive(void *pipefd) { cpy_log_exception("interactive session init"); } cur_sig = PyOS_setsig(SIGINT, python_sigint_handler); +#if PY_VERSION_HEX < 0x03070000 PyOS_AfterFork(); +#else + PyOS_AfterFork_Child(); +#endif PyEval_InitThreads(); close(*(int *)pipefd); PyRun_InteractiveLoop(stdin, "");