From e40aaa8aa855c9ab170efb259b21d0548564500e Mon Sep 17 00:00:00 2001 From: Martijn Dekker Date: Thu, 24 Sep 2020 15:43:49 +0200 Subject: [PATCH] Simplify comsub logic (re: 970069a6, 4ce486a7) There was still an opportunity for code simplification. No change in behaviour. --- src/cmd/ksh93/sh/xec.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/cmd/ksh93/sh/xec.c b/src/cmd/ksh93/sh/xec.c index 862dabbf7..72c7068be 100644 --- a/src/cmd/ksh93/sh/xec.c +++ b/src/cmd/ksh93/sh/xec.c @@ -1528,14 +1528,11 @@ 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]) &&