From 174ddfcdc3de44c6ccc5b2fb5ad15b80aee2d9c1 Mon Sep 17 00:00:00 2001 From: Tomi Ollila Date: Mon, 6 May 2024 08:10:30 +0300 Subject: [PATCH] Ignore SIGUSR1 and SIGUSR2 Some day there may be features bound to these signals. For now, ignore those -- this gives a period of time when sending SIGUSR1 and SIGUSR2 to a labwc process is safe, before someone may implement way to activate features bound to these signals. Related-to: #1700 --- src/common/spawn.c | 2 ++ src/server.c | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/common/spawn.c b/src/common/spawn.c index 6e8e7c51..c9b49286 100644 --- a/src/common/spawn.c +++ b/src/common/spawn.c @@ -23,6 +23,8 @@ reset_signals_and_limits(void) /* Restore ignored signals */ signal(SIGPIPE, SIG_DFL); + signal(SIGUSR1, SIG_DFL); + signal(SIGUSR2, SIG_DFL); } static bool diff --git a/src/server.c b/src/server.c index 503838cd..76a4acf5 100644 --- a/src/server.c +++ b/src/server.c @@ -328,6 +328,18 @@ server_init(struct server *server) */ signal(SIGPIPE, SIG_IGN); + /* + * Some day in the future, signal handlers may be assigned to these + * SIGUSR? signals. To give users a chance to develop extensions bound + * to these signals, make signalling labwc with SIGUSR[12] "safe" by + * ignoring these signals (as one may accidentally SIGUSR a labwc + * process not supporting such extensions). + * When signal handler assignment(s) is made, the corresponding + * signal(SIGUSR?, SIG_DFL); call(s) in spawn.c can be removed. + */ + signal(SIGUSR1, SIG_IGN); + signal(SIGUSR2, SIG_IGN); + /* * The backend is a feature which abstracts the underlying input and * output hardware. The autocreate option will choose the most suitable