nagios-plugins: build check_radius needs libradius
[omd.git] / packages / mod_python / patches / 0005-handle-sigterm-while-in-python.dif
blob6ebb765924fb153cf125e4e3d9d9cec16b2aac83
1 diff -ru mod_python-3.3.1.orig/src/mod_python.c mod_python-3.3.1/src/mod_python.c
2 --- mod_python-3.3.1.orig/src/mod_python.c      2006-11-09 07:21:23.000000000 +0100
3 +++ mod_python-3.3.1/src/mod_python.c   2011-12-21 16:59:16.171960122 +0100
4 @@ -1523,6 +1529,13 @@
5      }
6  }
7  
9 +int mod_python_got_killed;
10 +void sig_term_during_python(int s)
12 +    mod_python_got_killed = 1;
15  /**
16   ** python_handler
17   **
18 @@ -1649,8 +1662,15 @@
19       * This is the C equivalent of
20       * >>> resultobject = obCallBack.Dispatch(request_object, phase)
21       */
22 +    mod_python_got_killed = 0;
23 +    sighandler_t orig_handler = signal(SIGTERM, sig_term_during_python);
24      resultobject = PyObject_CallMethod(idata->obcallback, "HandlerDispatch",
25                                         "O", request_obj);
26 +    signal(SIGTERM, orig_handler);
27 +    if (mod_python_got_killed) {
28 +        ap_log_rerror(APLOG_MARK, APLOG_NOTICE, 0, req, "Got SIGTERM while Python running.");
29 +        exit(0);
30 +    }
32      /* clear phase from request object */
33      Py_XDECREF(request_obj->phase);