about summary refs log tree commit diff
path: root/Src/options.c
diff options
context:
space:
mode:
authorStephane Chazelas <stephane@chazelas.org>2024-02-18 18:52:50 +0000
committerStephane Chazelas <stephane@chazelas.org>2024-02-18 18:56:39 +0000
commitf1e7481b8690a6ef71a83853f05645cb774778ab (patch)
tree1e6c56c47891a6f412efda764d1e5b53279ae972 /Src/options.c
parentc2cf21c8f012db611bab1c92ee68e8af9d09fb65 (diff)
downloadzsh-f1e7481b8690a6ef71a83853f05645cb774778ab.tar.gz
zsh-f1e7481b8690a6ef71a83853f05645cb774778ab.tar.xz
zsh-f1e7481b8690a6ef71a83853f05645cb774778ab.zip
45837: fix process group restoration upon exit
Diffstat (limited to 'Src/options.c')
-rw-r--r--Src/options.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/Src/options.c b/Src/options.c
index a994b563e..a0e1aa024 100644
--- a/Src/options.c
+++ b/Src/options.c
@@ -881,11 +881,12 @@ dosetopt(int optno, int value, int force, char *new_opts)
     } else if (!force && optno == MONITOR && value) {
 	if (new_opts[optno] == value)
 	    return 0;
-	if (SHTTY != -1) {
+	if (SHTTY == -1)
+	    return -1;
+	if (!origpgrp) {
 	    origpgrp = GETPGRP();
 	    acquire_pgrp();
-	} else
-	    return -1;
+	}
 #else
     } else if(optno == MONITOR && value) {
 	    return -1;