components/ksh93/patches/17851169.patch
branchs11u1-sru
changeset 3011 9265805e77d5
child 6073 99c2bf34d78a
equal deleted inserted replaced
3010:07878573dad3 3011:9265805e77d5
       
     1 http://lists.research.att.com/pipermail/ast-developers/2014q1/003809.html
       
     2 ---
       
     3 --- a/src/cmd/ksh93/sh/subshell.c
       
     4 +++ b/src/cmd/ksh93/sh/subshell.c
       
     5 @@ -234,15 +234,22 @@ Namval_t *sh_assignok(register Namval_t *np,int add)
       
     6  {
       
     7  	register Namval_t	*mp;
       
     8  	register struct Link	*lp;
       
     9 -	register struct subshell *sp = (struct subshell*)subshell_data;
       
    10 -	Shell_t			*shp = sp->shp;
       
    11 -	Dt_t			*dp= shp->var_tree;
       
    12 +	register struct subshell *sp;
       
    13 +	Shell_t			*shp;
       
    14 +	Dt_t			*dp;
       
    15  	Namval_t		*mpnext;
       
    16  	Namarr_t		*ap;
       
    17  	int			save;
       
    18 +
       
    19 +        sp = (struct subshell*)subshell_data;
       
    20 +
       
    21  	/* don't bother with this */
       
    22 -	if(!sp->shpwd || np==SH_LEVELNOD || np==L_ARGNOD || np==SH_SUBSCRNOD || np==SH_NAMENOD)
       
    23 +	if(!sp || !sp->shpwd || np==SH_LEVELNOD || np==L_ARGNOD || np==SH_SUBSCRNOD || np==SH_NAMENOD)
       
    24  		return(np);
       
    25 +
       
    26 +	shp = sp->shp;
       
    27 +	dp = shp->var_tree;
       
    28 +
       
    29  	if((ap=nv_arrayptr(np)) && (mp=nv_opensub(np)))
       
    30  	{
       
    31  		shp->last_root = ap->table;
       
    32