Fix deletion of routing policy rules when terminating due to a signal
authorAlejandro Enrique <alejandro.enrique@fon.com>
Wed, 11 Feb 2015 16:44:38 +0000 (17:44 +0100)
committerFelix Fietkau <nbd@openwrt.org>
Fri, 13 Feb 2015 00:02:28 +0000 (11:02 +1100)
This patch fix routing policy rules not being deleted on termination
due to SIGTERM, SIGHUP, SIGUSR1 or SIGUSR2.
Calling uloop_end makes the call to uloop_run on main to finish and
the process to exit calling the proper cleaning functions.

Signed-off-by: Alejandro Enrique <alejandro.enrique@fon.com>
main.c

diff --git a/main.c b/main.c
index 318ba1c467a51f8e0d3cfd8bb91c214e679ffa37..24435b49b459e0de7e97365ad5088de6944f0583 100644 (file)
--- a/main.c
+++ b/main.c
@@ -670,9 +670,7 @@ static void die(int signo)
         * When we hit SIGTERM, clean up interfaces directly, so that we
         * won't leave our routing in an invalid state.
         */
-       cleanup_hosts();
-       free_interfaces();
-       exit(1);
+       uloop_end();
 }
 
 static int usage(const char *progname)