diff options
author | Tiago Cunha <tcunha@gmx.com> | 2009-10-12 00:21:08 +0000 |
---|---|---|
committer | Tiago Cunha <tcunha@gmx.com> | 2009-10-12 00:21:08 +0000 |
commit | 1b03bc2404a0892b9434b43603fc43282e6e36de (patch) | |
tree | d3f1d878151a512a252175edf09f6d13528efd98 /job.c | |
parent | b26ea8462ec0bb7d3d5cbeed115f6f4bbd4e1072 (diff) | |
download | rtmux-1b03bc2404a0892b9434b43603fc43282e6e36de.tar.gz rtmux-1b03bc2404a0892b9434b43603fc43282e6e36de.tar.bz2 rtmux-1b03bc2404a0892b9434b43603fc43282e6e36de.zip |
Sync OpenBSD patchset 382:
Collect status from dead jobs and don't invoke the callback until both
all input (the socket is closed) and status is available.
Diffstat (limited to 'job.c')
-rw-r--r-- | job.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -1,4 +1,4 @@ -/* $Id: job.c,v 1.3 2009-10-12 00:12:32 tcunha Exp $ */ +/* $Id: job.c,v 1.4 2009-10-12 00:21:08 tcunha Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -104,6 +104,8 @@ job_add(struct jobs *jobs, struct client *c, const char *cmd, job->freefn = freefn; job->data = data; + job->flags = JOB_DONE; + RB_INSERT(jobs, jobs, job); SLIST_INSERT_HEAD(&all_jobs, job, lentry); @@ -132,8 +134,9 @@ job_run(struct job *job) { int nullfd, out[2], mode; - if (job->fd != -1) + if (!(job->flags & JOB_DONE)) return (0); + job->flags &= ~JOB_DONE; if (pipe(out) != 0) return (-1); |