summaryrefslogtreecommitdiffstats
path: root/bin/sh
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>1995-09-21 13:24:20 +0000
committerbde <bde@FreeBSD.org>1995-09-21 13:24:20 +0000
commit5f0de3a1230e35199d19635efb3f6533b981de6b (patch)
treeee82fe3468f2479e5c766950834d4bbc82c859f8 /bin/sh
parentb7eab811e7da798485513be92f5fbff8b84651e9 (diff)
downloadFreeBSD-src-5f0de3a1230e35199d19635efb3f6533b981de6b.zip
FreeBSD-src-5f0de3a1230e35199d19635efb3f6533b981de6b.tar.gz
Fix relocation of job table.
while { sleep 1 & wait; } do echo 1; done corrupted the job table every 4th iteration.
Diffstat (limited to 'bin/sh')
-rw-r--r--bin/sh/jobs.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/bin/sh/jobs.c b/bin/sh/jobs.c
index c950bd4..ec8a649 100644
--- a/bin/sh/jobs.c
+++ b/bin/sh/jobs.c
@@ -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;
OpenPOWER on IntegriCloud