Dr. Werner Fink 2012-02-17 10:11:52 +00:00 committed by Git OBS Bridge
parent e79ee0613e
commit 797b3ca110
2 changed files with 27 additions and 9 deletions

View File

@ -17,6 +17,7 @@
# norootforbuild
Name: ksh
%global date 2012-02-02
%global use_suid_exe 0

View File

@ -489,11 +489,11 @@
#else
--- src/cmd/ksh93/sh/init.c
+++ src/cmd/ksh93/sh/init.c 2012-02-16 14:06:30.817933875 +0000
@@ -509,19 +509,31 @@ static void put_ifs(register Namval_t* n
@@ -509,19 +509,47 @@ static void put_ifs(register Namval_t* n
{
register struct ifs *ip = (struct ifs*)fp;
Shell_t *shp;
+ Namfun_t *xp = NIL(Namfun_t*);
+ Namfun_t *xp;
ip->ifsnp = 0;
- if(!val)
+ if(val)
@ -508,22 +508,39 @@
- if(val != np->nvalue.cp)
- nv_putv(np, val, flags, fp);
- if(!val && !(flags&NV_CLONE) && (fp=np->nvfun) && !fp->disc && (shp=(Shell_t*)(fp->last)))
- nv_stack(np,&((Init_t*)shp->init_context)->IFS_init.hdr);
- else if(!val)
+
+ xp = nv_stack(np, NIL(Namfun_t*));
+#if 0
+ if (xp != fp)
+ sfprintf(sfstdout, "BUG in %s:%s xp(%p) != fp(%p)\n", __FILE__, __FUNCTION__, xp, fp);
+ sfprintf(sfstderr, "BUG in %s:%s(%d) xp(%p) != fp(%p)\n",
+ __FILE__, __FUNCTION__, __LINE__, xp, fp);
+#endif
+ nv_putv(np, val, flags, NIL(Namfun_t*));
+ nv_putv(np, NIL(char*), flags, NIL(Namfun_t*));
+ if(xp && xp->nofree == 0)
+ free((void*)xp);
+ if(!(flags&NV_CLONE) && (fp=np->nvfun) && !fp->disc && (shp=(Shell_t*)(fp->last)))
nv_stack(np,&((Init_t*)shp->init_context)->IFS_init.hdr);
- else if(!val)
+ xp = NIL(Namfun_t*);
+
+ if((fp=np->nvfun) && (shp=(Shell_t*)(fp->last)))
+ xp = &((Init_t*)shp->init_context)->IFS_init.hdr;
+
+ if(!(flags&NV_CLONE) && fp && !fp->disc && xp)
+ nv_stack(np, xp);
+ else
+ {
+ if((fp=np->nvfun) && (shp=(Shell_t*)(fp->last)))
+ sh_scoped(shp,IFSNOD)->nvfun = 0; /* Uninitialized area */
+ if(xp)
+ {
+ Namval_t* sp = sh_scoped(shp,IFSNOD);
+ if(sp->nvfun != xp)
+ {
+#if 0
+ sfprintf(sfstderr, "BUG in %s:%s(%d) sp->nvfun(%p) != xp(%p)\n",
+ __FILE__, __FUNCTION__, __LINE__, sp->nvfun, xp);
+#endif
+ sp->nvfun = xp;
+ }
+ }
np->nvfun = 0;
+ }
}