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