Commit 9d790ec3 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Also lock the to-fd

parent ead65de2
...@@ -178,10 +178,12 @@ process_thread(void *priv) ...@@ -178,10 +178,12 @@ process_thread(void *priv)
} }
r = wait4(p->pid, &p->status, 0, &ru); r = wait4(p->pid, &p->status, 0, &ru);
closefd(&p->fd_to);
AZ(pthread_mutex_lock(&p->mtx)); AZ(pthread_mutex_lock(&p->mtx));
if (p->fd_to >= 0)
closefd(&p->fd_to);
macro_undef(p->vl, p->name, "pid"); macro_undef(p->vl, p->name, "pid");
p->pid = -1; p->pid = -1;
...@@ -361,7 +363,10 @@ process_close(struct process *p) ...@@ -361,7 +363,10 @@ process_close(struct process *p)
if (!p->hasthread) if (!p->hasthread)
vtc_log(p->vl, 0, "Cannot close on a non-running process"); vtc_log(p->vl, 0, "Cannot close on a non-running process");
closefd(&p->fd_to); AZ(pthread_mutex_lock(&p->mtx));
if (p->fd_to >= 0)
closefd(&p->fd_to);
AZ(pthread_mutex_unlock(&p->mtx));
} }
/* SECTION: process process /* SECTION: process process
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment