commit 0f4d5294adfa180511f4087334dffa37c5cf6558
parent bc33a5def48d12c8d9459a5faed3b37ad65dc07e
Author: Joris Vink <joris@coders.se>
Date: Tue, 15 Oct 2019 14:25:57 +0200
store active pid into apid so it does not overwritten.
Diffstat:
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/include/kore/python_methods.h b/include/kore/python_methods.h
@@ -513,6 +513,7 @@ static PyTypeObject pylock_op_type = {
struct pyproc {
PyObject_HEAD
pid_t pid;
+ pid_t apid;
int reaped;
int status;
struct pysocket *in;
diff --git a/src/python.c b/src/python.c
@@ -2183,6 +2183,7 @@ python_kore_proc(PyObject *self, PyObject *args)
}
proc->pid = -1;
+ proc->apid = -1;
proc->reaped = 0;
proc->status = 0;
proc->timer = NULL;
@@ -2231,6 +2232,7 @@ python_kore_proc(PyObject *self, PyObject *args)
!kore_connection_nonblock(out_pipe[0], 0))
fatal("failed to mark kore.proc pipes are non-blocking");
+ proc->apid = proc->pid;
proc->in->fd = in_pipe[1];
proc->out->fd = out_pipe[0];
@@ -3693,7 +3695,7 @@ pyproc_close_stdin(struct pyproc *proc, PyObject *args)
static PyObject *
pyproc_get_pid(struct pyproc *proc, void *closure)
{
- return (PyLong_FromLong(proc->pid));
+ return (PyLong_FromLong(proc->apid));
}
static void