components/ksh93/patches/155-CR7178717.patch
changeset 4196 d697072a92f5
parent 917 c2d902bbacc9
equal deleted inserted replaced
4195:d88c5d15a4af 4196:d697072a92f5
       
     1 *** INIT.2011-02-08/src/cmd/ksh93/sh/jobs.c	Tue Jul 10 17:37:30 2012
       
     2 --- ./jobs.c	Tue Jul 10 18:59:39 2012
       
     3 ***************
       
     4 *** 1969,1985 ****
       
     5   	register struct back_save *bp = (struct back_save*)ptr;
       
     6   	register struct process *pw, *px, *pwnext;
       
     7   	struct jobsave *jpnext;
       
     8   	job_lock();
       
     9 ! 	for(jp=bck.list; jp; jp=jpnext)
       
    10 ! 	{
       
    11   		jpnext = jp->next;
       
    12 ! 		if(jp->curenv != sh.curenv || jp->pid==sh.spid)
       
    13 ! 		{
       
    14 ! 			jp->next = bp->list;
       
    15 ! 			bp->list = jp;
       
    16 ! 			bp->count++;
       
    17 ! 		}
       
    18 ! 		else
       
    19   			job_chksave(jp->pid);
       
    20   	}
       
    21   	for(pw=job.pwlist; pw; pw=pwnext)
       
    22 --- 1969,2000 ----
       
    23   	register struct back_save *bp = (struct back_save*)ptr;
       
    24   	register struct process *pw, *px, *pwnext;
       
    25   	struct jobsave *jpnext;
       
    26 + 
       
    27   	job_lock();
       
    28 ! 	for(jp = bck.list; jp != NULL; jp = jpnext) {
       
    29   		jpnext = jp->next;
       
    30 ! 		if (jp->curenv != sh.curenv || jp->pid == sh.spid) {
       
    31 ! 			struct jobsave *jp2, *jp2next;
       
    32 ! 			/*
       
    33 ! 			 * We may have same pid in both saved list and current
       
    34 ! 			 * list. We discard the old jobsave by copying the new
       
    35 ! 			 * one.
       
    36 ! 			 */
       
    37 ! 			for (jp2 = bp->list; jp2 != NULL; jp2 = jp2->next) {
       
    38 ! 				if (jp->pid == jp2->pid)
       
    39 ! 					break;
       
    40 ! 			}
       
    41 ! 			if (jp2 != NULL) {
       
    42 ! 				jp2next = jp2->next;
       
    43 ! 				*jp2 = *jp;
       
    44 ! 				jp2->next = jp2next;
       
    45 ! 				job_chksave(jp2->pid);
       
    46 ! 			} else {
       
    47 ! 				jp->next = bp->list;
       
    48 ! 				bp->list = jp;
       
    49 ! 				bp->count++;
       
    50 ! 			}
       
    51 ! 		} else
       
    52   			job_chksave(jp->pid);
       
    53   	}
       
    54   	for(pw=job.pwlist; pw; pw=pwnext)