From patchwork Wed Feb 11 16:44:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alejandro Enrique X-Patchwork-Id: 438896 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from arrakis.dune.hu (arrakis.dune.hu [78.24.191.176]) (using TLSv1.1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 9AB15140129 for ; Thu, 12 Feb 2015 03:45:25 +1100 (AEDT) Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 1F87A28A6C8; Wed, 11 Feb 2015 17:42:37 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on arrakis.dune.hu X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00 autolearn=unavailable version=3.3.2 Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 5C4EF28A6C8 for ; Wed, 11 Feb 2015 17:42:29 +0100 (CET) X-policyd-weight: using cached result; rate: -8.5 Received: from mail-wi0-f176.google.com (mail-wi0-f176.google.com [209.85.212.176]) by arrakis.dune.hu (Postfix) with ESMTPS for ; Wed, 11 Feb 2015 17:42:29 +0100 (CET) Received: by mail-wi0-f176.google.com with SMTP id h11so5245801wiw.3 for ; Wed, 11 Feb 2015 08:45:06 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Q6iNzKvIUZu8SmeW7xrMq4a1v1GB9S586dYzPtVCeuw=; b=GnKzRn5wH2kjAaiRrzOS9tSDXPUvLE712xRJgrcSe9jlYO0iucLkQT4nM+SsNXmku1 4BcAUoxdh59X3JQdW1w0SpbYhIgF92Q/2b3lLQoSDI9W9pCRp1ayjIlMpbPUDf7ZdB4q E2RT2kJziOXs4wvT0elauWGhWF2piWmqSHgfnvUHzpgXHv0AoExhkBapEiEDMWT89a5V Ov+WOB52XAN17XVUbjPfw/NeD76xwkDbjukLZ4eFUFmjzOI1qhyruuqnlZV8exOxvaaW 0h6c2bALQdqdcu4rOYJCQd3ZyhIX/PRz+b7bYeymazsGUYhe5rjjPYLev9PscoqsEecy 7RnA== X-Gm-Message-State: ALoCoQnyCpqwT2Adf79RrDMNF9qsJVQLVcfcQlotx1Jvj09NkWOC7sX1g00BWiov1L/rUIj6Knkq X-Received: by 10.194.179.166 with SMTP id dh6mr65449098wjc.87.1423673106687; Wed, 11 Feb 2015 08:45:06 -0800 (PST) Received: from dell-desktop.lan ([213.27.197.25]) by mx.google.com with ESMTPSA id gm10sm23970834wib.19.2015.02.11.08.45.05 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Feb 2015 08:45:06 -0800 (PST) From: Alejandro Enrique To: Felix Fietkau Date: Wed, 11 Feb 2015 17:44:38 +0100 Message-Id: <1423673078-16652-1-git-send-email-alejandro.enrique@fon.com> X-Mailer: git-send-email 1.7.10.4 Cc: openwrt-devel@lists.openwrt.org Subject: [OpenWrt-Devel] [PATCH relayd] Fix deletion of routing policy rules when terminating due to a signal X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: openwrt-devel-bounces@lists.openwrt.org Sender: "openwrt-devel" 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 --- main.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/main.c b/main.c index 318ba1c..24435b4 100644 --- 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)