Mailing List Archive

svn commit: vpnc r540 - /branches/vpnc-nortel/tunip.c /trunk/tunip.c
Author: Antonio Borneo
Date: Tue Jan 14 15:54:13 2014
New Revision: 540

Log:
Bug fix: don't call exit handler when daemonize

Bug introduced in commit r528, "Always run vpnc-script at exit".

When vpnc goes background, the foreground task have to exit
without calling the handler registerd with atexit(), otherwise
vpnc-script would modify routing tables.

Bug found by Alon Bar-Lev <alon.barlev@gmail.com>

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>

Modified:
branches/vpnc-nortel/tunip.c
trunk/tunip.c

Modified: branches/vpnc-nortel/tunip.c
==============================================================================
--- branches/vpnc-nortel/tunip.c (original)
+++ branches/vpnc-nortel/tunip.c Tue Jan 14 15:54:13 2014
@@ -1049,7 +1049,12 @@
setsid();
} else {
printf("VPNC started in background (pid: %d)...\n", (int)pid);
- exit(0);
+ /*
+ * Use _exit(), since exit() will call the handler
+ * registered with atexit() that will remove the
+ * route path to concentrator.
+ */
+ _exit(0);
}
openlog("vpnc", LOG_PID | LOG_PERROR, LOG_DAEMON);
logmsg = syslog;

Modified: trunk/tunip.c
==============================================================================
--- trunk/tunip.c (original)
+++ trunk/tunip.c Tue Jan 14 15:54:13 2014
@@ -1049,7 +1049,12 @@
setsid();
} else {
printf("VPNC started in background (pid: %d)...\n", (int)pid);
- exit(0);
+ /*
+ * Use _exit(), since exit() will call the handler
+ * registered with atexit() that will remove the
+ * route path to concentrator.
+ */
+ _exit(0);
}
openlog("vpnc", LOG_PID | LOG_PERROR, LOG_DAEMON);
logmsg = syslog;

_______________________________________________
vpnc-devel mailing list
vpnc-devel@unix-ag.uni-kl.de
https://lists.unix-ag.uni-kl.de/mailman/listinfo/vpnc-devel
http://www.unix-ag.uni-kl.de/~massar/vpnc/