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

Simplify comsub logic (re: 970069a6, 4ce486a7)

There was still an opportunity for code simplification.
No change in behaviour.
This commit is contained in:
Martijn Dekker 2020-09-24 15:43:49 +02:00
parent a14d17c0f4
commit e40aaa8aa8

View file

@ -1528,15 +1528,12 @@ int sh_exec(register const Shnode_t *t, int flags)
if(shp->subshell)
{
sh_subtmpfile(2);
if(shp->comsub==1 && (!(shp->fdstatus[1]&IONOSEEK)))
if((shp->comsub && (type&(FAMP|TFORK))==(FAMP|TFORK) || shp->comsub==1) &&
!(shp->fdstatus[1]&IONOSEEK))
unpipe = iousepipe(shp);
if((type&(FAMP|TFORK))==(FAMP|TFORK))
{
if(shp->comsub && !(shp->fdstatus[1]&IONOSEEK) && !unpipe)
unpipe = iousepipe(shp);
sh_subfork();
}
}
no_fork = !ntflag && !(type&(FAMP|FPOU)) && !shp->subshell &&
!(shp->st.trapcom[SIGINT] && *shp->st.trapcom[SIGINT]) &&
!shp->st.trapcom[0] && !shp->st.trap[SH_ERRTRAP] &&