summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Schodet2011-09-06 16:14:51 +0200
committerNicolas Schodet2011-12-20 15:49:26 +0100
commit6faf1b00794edca6916658126102bade9300f722 (patch)
treed1f5e509f83be4039ec73f22ed8c313eaa0bb568
parent17e553ad5421b9287bc2aeabd881af172f429329 (diff)
cleo/devkit/plcd: unregister from file update on exit, refs #2701
-rw-r--r--cleopatre/devkit/plcd/src/plcd_main.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/cleopatre/devkit/plcd/src/plcd_main.c b/cleopatre/devkit/plcd/src/plcd_main.c
index eb7248f457..4145900ecc 100644
--- a/cleopatre/devkit/plcd/src/plcd_main.c
+++ b/cleopatre/devkit/plcd/src/plcd_main.c
@@ -41,6 +41,7 @@ static spc300_nvram_t g_nvram;
volatile sig_atomic_t is_process_signal_needed;
+volatile sig_atomic_t exit_requested;
/******************************************************************************/
/* DEBUG FUNCTION */
@@ -74,11 +75,15 @@ plcd_print_usage (const char *cmd)
void
plcd_signal_handler (int signal_nb)
{
- /* check that we received a SIGHUP signal (other signals must be ignored) */
+ /* Check received signal. */
if (SIGHUP == signal_nb)
{
is_process_signal_needed = 1;
}
+ else if (SIGTERM == signal_nb)
+ {
+ exit_requested = 1;
+ }
}
@@ -313,8 +318,11 @@ main (int argc, char **argv)
exit (EXIT_FAILURE);
}
+ /* Catch SIGTERM. */
+ signal (SIGTERM, plcd_signal_handler);
+
/* now get all events from plcdrv (i.e. DRV MME-s) */
- while (1)
+ while (!exit_requested)
{
if (0 > plcd_stack_event_dispatch (&ctx))
{
@@ -322,6 +330,9 @@ main (int argc, char **argv)
}
}
+ libspid_system_file_update_unregister (pid, LIBSPID_HPAV_CONF_PATH);
+ libspid_system_file_update_unregister (pid, LIBSPID_HPAV_INFO_PATH);
+ libspid_system_file_update_unregister (pid, LIBSPID_MULTICAST_INFO_PATH);
plcd_uninit (&ctx);
exit (EXIT_SUCCESS);
}