summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego Santa Cruz <Diego.SantaCruz@spinetix.com>2020-09-09 16:54:21 +0000
committerTobias Klauser <tobias.klauser@gmail.com>2020-09-10 09:27:53 +0200
commita1a821814101144d242dff00922ece0462b56f72 (patch)
tree96d54b2d5ba8837caaf2da9dd577294d661a5827
parent9709b4e2f5a32aab087c65994a600dc465310918 (diff)
llmnrd: only async signal safe functions may be called in signal handler
Signal handlers may only call async signal safe functions and logging is certainly not async signal safe, so move the log message to the main loop. While at it change "Interrupt" for "Signal" in the message which is more appropriate. Signed-off-by: Diego Santa Cruz <Diego.SantaCruz@spinetix.com>
-rw-r--r--llmnrd.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/llmnrd.c b/llmnrd.c
index ba5023c..e79db24 100644
--- a/llmnrd.c
+++ b/llmnrd.c
@@ -91,7 +91,6 @@ static void signal_handler(int sig)
case SIGINT:
case SIGQUIT:
case SIGTERM:
- log_info("Interrupt received. Stopping llmnrd.\n");
llmnrd_running = false;
break;
case SIGHUP:
@@ -281,6 +280,8 @@ int main(int argc, char **argv)
}
}
+ log_info("Signal received. Stopping llmnrd.\n");
+
ret = 0;
out:
if (llmnrd_sock_rtnl >= 0)