1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

Re-obtain PID when optimising ( simple_command & ) (re: af6a32d1)

src/cmd/ksh93/sh/xec.c: sh_exec(): TCOM:
- In the referenced commit I'd accidentally deleted this line:
    shgd->current_pid = getpid();
  from the routine to optimise the ( simple_command & ) case.
  This resulted in the following regression test failure on
  ARM boxes:
    variables.sh[71]: Test 4: $RANDOM seed in ( simple_command & )
  The cause was that the current PID shgd->current_pid, which is
  factored into the seed, was not updated before reseeding.
  Apparently the system clock on ARM systems is not fine-grained
  enough to compensate.
This commit is contained in:
Martijn Dekker 2021-05-07 14:43:19 +01:00
parent 2758e5db19
commit 6b3805724d

View file

@ -1991,6 +1991,7 @@ int sh_exec(register const Shnode_t *t, int flags)
_sh_fork(shp,pid,0,0); _sh_fork(shp,pid,0,0);
if(pid==0) if(pid==0)
{ {
shgd->current_pid = getpid();
sh_reseed_rand((struct rand*)RANDNOD->nvfun); sh_reseed_rand((struct rand*)RANDNOD->nvfun);
shgd->realsubshell++; shgd->realsubshell++;
sh_exec(t->par.partre,flags); sh_exec(t->par.partre,flags);