commit c3fbeeeae176034b869f84d283953edaf89ecf91
parent bf7f4ef13d96ab28c62f790929e5aa227b4e8d0f
Author: Santtu Lakkala <inz@inz.fi>
Date: Tue, 4 Jul 2023 13:20:23 +0300
Add no-op SIGHUP handler
Add handler for SIGHUP that does nothing. Receiving a SIGHUP will
interrupt the sleep call and cause re-check of IP.
Diffstat:
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git a/udyfi.c b/udyfi.c
@@ -130,6 +130,11 @@ static void sig_handler(int signum)
running = false;
}
+static void sighup_handler(int signum)
+{
+ (void)signum;
+}
+
static ssize_t http_get(const char *server,
const char *port,
const char *path,
@@ -792,6 +797,7 @@ cfgtoggle:
signal(SIGINT, sig_handler);
signal(SIGTERM, sig_handler);
+ sigaction(SIGHUP, &(struct sigaction){ .sa_handler = sighup_handler }, NULL);
while (running) {
time_t now = time(NULL);