1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-13 03:32:24 +00:00

Upstream an Apple patch to array.c

This upstreams the patch 'src__cmd__ksh93__sh__array.c.diff' from
Apple's ksh 93u+ distribution in ksh-28.tar.gz:
https://opensource.apple.com/tarballs/ksh/

src/cmd/ksh93/sh/array.c: array_putval(), nv_associative():
- Zero two table pointers after closing/freeing the tables with
  libast's dtclose(). No information is available from Apple as to
  what specific problems this fixes, but at worst this is harmless.
This commit is contained in:
Martijn Dekker 2021-08-11 02:48:36 +02:00
parent 3937536bee
commit 6952d444ae

View file

@ -681,7 +681,10 @@ static void array_putval(Namval_t *np, const char *string, int flags, Namfun_t *
if(is_associative(ap))
(*ap->fun)(np, NIL(char*), NV_AFREE);
else if(ap->table)
{
dtclose(ap->table);
ap->table = 0;
}
nv_offattr(np,NV_ARRAY);
}
if(!mp || mp!=np || is_associative(ap))
@ -1702,6 +1705,7 @@ void *nv_associative(register Namval_t *np,const char *sp,int mode)
if((ap->header.nelem&ARRAY_MASK)==0 && (ap->cur=nv_search("0",ap->header.table,0)))
nv_associative(np,(char*)0,NV_ADELETE);
dtclose(ap->header.table);
ap->header.table = 0;
}
return((void*)ap);
case NV_ANEXT: