|
|
2642b8 |
diff -up ksh-20120801/src/cmd/ksh93/include/name.h.memlik3 ksh-20120801/src/cmd/ksh93/include/name.h
|
|
|
2642b8 |
--- ksh-20120801/src/cmd/ksh93/include/name.h.memlik3 2012-05-10 18:33:41.000000000 +0200
|
|
|
2642b8 |
+++ ksh-20120801/src/cmd/ksh93/include/name.h 2014-01-22 14:14:32.774483776 +0100
|
|
|
2642b8 |
@@ -215,7 +215,7 @@ extern Namval_t *nv_mount(Namval_t*, co
|
|
|
2642b8 |
extern Namval_t *nv_arraychild(Namval_t*, Namval_t*, int);
|
|
|
2642b8 |
extern int nv_compare(Dt_t*, Void_t*, Void_t*, Dtdisc_t*);
|
|
|
2642b8 |
extern void nv_outnode(Namval_t*,Sfio_t*, int, int);
|
|
|
2642b8 |
-extern int nv_subsaved(Namval_t*);
|
|
|
2642b8 |
+extern int nv_subsaved(Namval_t*,int);
|
|
|
2642b8 |
extern void nv_typename(Namval_t*, Sfio_t*);
|
|
|
2642b8 |
extern void nv_newtype(Namval_t*);
|
|
|
2642b8 |
extern int nv_istable(Namval_t*);
|
|
|
2642b8 |
diff -up ksh-20120801/src/cmd/ksh93/sh/name.c.memlik3 ksh-20120801/src/cmd/ksh93/sh/name.c
|
|
|
2642b8 |
--- ksh-20120801/src/cmd/ksh93/sh/name.c.memlik3 2014-01-22 14:14:32.751483987 +0100
|
|
|
2642b8 |
+++ ksh-20120801/src/cmd/ksh93/sh/name.c 2014-01-22 14:14:32.775483767 +0100
|
|
|
2642b8 |
@@ -1297,7 +1297,7 @@ void nv_delete(Namval_t* np, Dt_t *root,
|
|
|
2642b8 |
{
|
|
|
2642b8 |
if(dtdelete(root,np))
|
|
|
2642b8 |
{
|
|
|
2642b8 |
- if(!(flags&NV_NOFREE) && ((flags&NV_FUNCTION) || !nv_subsaved(np)))
|
|
|
2642b8 |
+ if(!(flags&NV_NOFREE) && ((flags&NV_FUNCTION) || !nv_subsaved(np,flags&NV_TABLE)))
|
|
|
2642b8 |
free((void*)np);
|
|
|
2642b8 |
}
|
|
|
2642b8 |
#if 0
|
|
|
2642b8 |
@@ -2461,14 +2461,14 @@ static void table_unset(Shell_t *shp, re
|
|
|
2642b8 |
{
|
|
|
2642b8 |
_nv_unset(nq,flags);
|
|
|
2642b8 |
npnext = (Namval_t*)dtnext(root,nq);
|
|
|
2642b8 |
- nv_delete(nq,root,0);
|
|
|
2642b8 |
+ nv_delete(nq,root,NV_TABLE);
|
|
|
2642b8 |
}
|
|
|
2642b8 |
}
|
|
|
2642b8 |
npnext = (Namval_t*)dtnext(root,np);
|
|
|
2642b8 |
if(nv_arrayptr(np))
|
|
|
2642b8 |
nv_putsub(np,NIL(char*),ARRAY_SCAN);
|
|
|
2642b8 |
_nv_unset(np,flags);
|
|
|
2642b8 |
- nv_delete(np,root,0);
|
|
|
2642b8 |
+ nv_delete(np,root,NV_TABLE);
|
|
|
2642b8 |
}
|
|
|
2642b8 |
}
|
|
|
2642b8 |
|
|
|
2642b8 |
diff -up ksh-20120801/src/cmd/ksh93/sh/subshell.c.memlik3 ksh-20120801/src/cmd/ksh93/sh/subshell.c
|
|
|
2642b8 |
--- ksh-20120801/src/cmd/ksh93/sh/subshell.c.memlik3 2014-01-22 14:14:32.768483831 +0100
|
|
|
2642b8 |
+++ ksh-20120801/src/cmd/ksh93/sh/subshell.c 2014-01-22 14:20:50.810236676 +0100
|
|
|
2642b8 |
@@ -218,16 +218,28 @@ void sh_subfork(void)
|
|
|
2642b8 |
}
|
|
|
2642b8 |
}
|
|
|
2642b8 |
|
|
|
2642b8 |
-int nv_subsaved(register Namval_t *np)
|
|
|
2642b8 |
+int nv_subsaved(register Namval_t *np,int table)
|
|
|
2642b8 |
{
|
|
|
2642b8 |
register struct subshell *sp;
|
|
|
2642b8 |
- register struct Link *lp;
|
|
|
2642b8 |
+ register struct Link *lp, *lpprev;
|
|
|
2642b8 |
for(sp = (struct subshell*)subshell_data; sp; sp=sp->prev)
|
|
|
2642b8 |
{
|
|
|
2642b8 |
- for(lp=sp->svar; lp; lp = lp->next)
|
|
|
2642b8 |
+ lpprev = 0;
|
|
|
2642b8 |
+ for(lp=sp->svar; lp; lpprev=lp, lp=lp->next)
|
|
|
2642b8 |
{
|
|
|
2642b8 |
if(lp->node==np)
|
|
|
2642b8 |
+ {
|
|
|
2642b8 |
+ if(table&NV_TABLE)
|
|
|
2642b8 |
+ {
|
|
|
2642b8 |
+ if(lpprev)
|
|
|
2642b8 |
+ lpprev->next = lp->next;
|
|
|
2642b8 |
+ else
|
|
|
2642b8 |
+ sp->svar = lp->next;
|
|
|
2642b8 |
+ free((void*)np);
|
|
|
2642b8 |
+ free((void*)lp);
|
|
|
2642b8 |
+ }
|
|
|
2642b8 |
return(1);
|
|
|
2642b8 |
+ }
|
|
|
2642b8 |
}
|
|
|
2642b8 |
}
|
|
|
2642b8 |
return(0);
|