diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2009-11-04 21:10:50 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2009-11-04 21:10:50 +0000 |
commit | 4a10595dee0afa24fc6f3744ea05adc59019ae4e (patch) | |
tree | 47832697729cfa176889036a5b6e7fa21ab8373c /usr.bin/tmux | |
parent | 69b2d345034deaad1ed3e6a7107713027c4989c3 (diff) |
Add back JOB_PERSIST checks that got lost.
Diffstat (limited to 'usr.bin/tmux')
-rw-r--r-- | usr.bin/tmux/job.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/usr.bin/tmux/job.c b/usr.bin/tmux/job.c index 375507f87d8..cc8bb2b56bc 100644 --- a/usr.bin/tmux/job.c +++ b/usr.bin/tmux/job.c @@ -1,4 +1,4 @@ -/* $OpenBSD: job.c,v 1.11 2009/11/04 21:04:43 nicm Exp $ */ +/* $OpenBSD: job.c,v 1.12 2009/11/04 21:10:49 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -127,7 +127,6 @@ job_free(struct job *job) if (job->fd != -1) close(job->fd); - if (job->event != NULL) bufferevent_free(job->event); @@ -202,8 +201,12 @@ job_callback(unused struct bufferevent *bufev, unused short events, void *data) close(job->fd); job->fd = -1; - if (job->pid == -1 && job->callbackfn != NULL) - job->callbackfn(job); + if (job->pid == -1) { + if (job->callbackfn != NULL) + job->callbackfn(job); + if ((!job->flags & JOB_PERSIST)) + job_free(job); + } } /* Job died (waitpid() returned its pid). */ @@ -213,8 +216,12 @@ job_died(struct job *job, int status) job->status = status; job->pid = -1; - if (job->fd == -1 && job->callbackfn != NULL) - job->callbackfn(job); + if (job->fd == -1) { + if (job->callbackfn != NULL) + job->callbackfn(job); + if ((!job->flags & JOB_PERSIST)) + job_free(job); + } } /* Kill a job. */ |