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>
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);