Sync OpenBSD patchset 494:

Add back JOB_PERSIST checks that got lost.
pull/1/head
Tiago Cunha 2009-11-08 22:56:54 +00:00
parent 53ef4c2bab
commit 7851bb81f5
1 changed files with 13 additions and 6 deletions

19
job.c
View File

@ -1,4 +1,4 @@
/* $Id: job.c,v 1.11 2009-11-08 22:56:04 tcunha Exp $ */
/* $Id: job.c,v 1.12 2009-11-08 22:56:54 tcunha Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@ -126,7 +126,6 @@ job_free(struct job *job)
if (job->fd != -1)
close(job->fd);
if (job->event != NULL)
bufferevent_free(job->event);
@ -201,8 +200,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). */
@ -212,8 +215,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. */