]> www.infradead.org Git - users/dwmw2/openconnect.git/commitdiff
Create new process group for script
authorDimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
Wed, 2 Nov 2022 23:21:51 +0000 (00:21 +0100)
committerDimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
Thu, 9 Jan 2025 17:10:19 +0000 (18:10 +0100)
The SINGINT signal is delivered to the each process of the OpenConnect
process group. We want the script to run in a different process group,
so that SIGINT is not delivered to the script. We want the script to
finish its task, typically set/reset routing and DNS.

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
script.c

index a9922e36a890194e07bd39b9cbae04cdecea931b..8742e761125c22d90c2c904281fb6a96029f825a 100644 (file)
--- a/script.c
+++ b/script.c
@@ -676,8 +676,11 @@ int script_config_tun(struct openconnect_info *vpninfo, const char *reason)
                return 0;
 
        pid = fork();
-       if (!pid) {
+       if (pid == 0) {
                /* Child */
+               if (setpgid(0, 0) < 0)
+                       perror(_("setpgid"));
+
                char *script = openconnect_utf8_to_legacy(vpninfo, vpninfo->vpnc_script);
 
                apply_script_env(vpninfo->script_env);