Fix relocation of job table.
while { sleep 1 & wait; } do echo 1; done corrupted the job table every 4th iteration.
This commit is contained in:
parent
4d34303860
commit
beff52884f
@ -33,7 +33,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: jobs.c,v 1.2 1994/09/24 02:57:41 davidg Exp $
|
||||
* $Id: jobs.c,v 1.3 1995/05/30 00:07:18 rgrimes Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -459,7 +459,14 @@ makejob(node, nprocs)
|
||||
if (njobs == 0) {
|
||||
jobtab = ckmalloc(4 * sizeof jobtab[0]);
|
||||
} else {
|
||||
struct job *ojp;
|
||||
|
||||
jp = ckmalloc((njobs + 4) * sizeof jobtab[0]);
|
||||
for (i = njobs, ojp = jobtab; --i >= 0;
|
||||
jp++, ojp++)
|
||||
if (ojp->ps == &ojp->ps0)
|
||||
ojp->ps = &jp->ps0;
|
||||
jp -= njobs;
|
||||
bcopy(jobtab, jp, njobs * sizeof jp[0]);
|
||||
ckfree(jobtab);
|
||||
jobtab = jp;
|
||||
|
Loading…
x
Reference in New Issue
Block a user