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

Fix exec/redirect (fd != 1) in shared-state comsub (re: db72f41f)

That OpenSUSE patch introduced a bug: file descriptors other than 1
that were globally redirected using 'exec' or 'redirect' no longer
survived a ${ shared-state; } command substitution.

Related: https://github.com/ksh93/ksh/issues/128

src/cmd/ksh93/sh/io.c:
- Add check for shp->subshare to the OpenSUSE patch.

src/cmd/ksh93/tests/io.sh:
- Add test.
This commit is contained in:
Martijn Dekker 2021-02-13 15:56:13 +00:00
parent 5529d13d28
commit fb7551634a
2 changed files with 9 additions and 1 deletions

View file

@ -1448,7 +1448,7 @@ int sh_redirect(Shell_t *shp,struct ionod *iop, int flag)
}
else if(sh_subsavefd(fn))
{
if(fd==fn)
if(fd==fn && !shp->subshare)
{
if((r=sh_fcntl(fd,F_DUPFD,10)) > 0)
{