diff --git a/proc.cpp b/proc.cpp index 749f38c2c..d0412414b 100644 --- a/proc.cpp +++ b/proc.cpp @@ -296,15 +296,19 @@ int job_is_stopped(const job_t *j) \param j the job to test */ -int job_is_completed(const job_t *j) +bool job_is_completed(const job_t *j) { - process_t *p; assert(j->first_process != NULL); - for (p = j->first_process; p->next; p = p->next) - ; - - return p->completed; - + bool result = true; + for (process_t *p = j->first_process; p != NULL; p = p->next) + { + if (! p->completed) + { + result = false; + break; + } + } + return result; } void job_set_flag(job_t *j, unsigned int flag, int set) diff --git a/proc.h b/proc.h index b320a49af..163831116 100644 --- a/proc.h +++ b/proc.h @@ -507,7 +507,7 @@ int job_is_stopped(const job_t *j); /** Tests if the job has completed, i.e. if the last process of the pipeline has ended. */ -int job_is_completed(const job_t *j); +bool job_is_completed(const job_t *j); /** Reassume a (possibly) stopped job. Put job j in the foreground. If