diff options
author | Stephane Chazelas <stephane@chazelas.org> | 2024-02-18 18:52:50 +0000 |
---|---|---|
committer | Stephane Chazelas <stephane@chazelas.org> | 2024-02-18 18:56:39 +0000 |
commit | f1e7481b8690a6ef71a83853f05645cb774778ab (patch) | |
tree | 1e6c56c47891a6f412efda764d1e5b53279ae972 /Src/init.c | |
parent | c2cf21c8f012db611bab1c92ee68e8af9d09fb65 (diff) | |
download | zsh-f1e7481b8690a6ef71a83853f05645cb774778ab.tar.gz zsh-f1e7481b8690a6ef71a83853f05645cb774778ab.tar.xz zsh-f1e7481b8690a6ef71a83853f05645cb774778ab.zip |
45837: fix process group restoration upon exit
Diffstat (limited to 'Src/init.c')
-rw-r--r-- | Src/init.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/Src/init.c b/Src/init.c index 799ad19f6..83b79d3d4 100644 --- a/Src/init.c +++ b/Src/init.c @@ -700,11 +700,14 @@ init_io(char *cmd) * process group leader. */ mypid = (zlong)getpid(); - if (opts[MONITOR] && (SHTTY != -1)) { - origpgrp = GETPGRP(); - acquire_pgrp(); /* might also clear opts[MONITOR] */ - } else - opts[MONITOR] = 0; + if (opts[MONITOR]) { + if (SHTTY == -1) + opts[MONITOR] = 0; + else if (!origpgrp) { + origpgrp = GETPGRP(); + acquire_pgrp(); /* might also clear opts[MONITOR] */ + } + } #else opts[MONITOR] = 0; #endif |