diff options
author | Okan Demirmen <okan@cvs.openbsd.org> | 2020-03-23 20:14:28 +0000 |
---|---|---|
committer | Okan Demirmen <okan@cvs.openbsd.org> | 2020-03-23 20:14:28 +0000 |
commit | 3d8a0ab75ebfb2e032b0e438fcd51ad6373d008c (patch) | |
tree | f392e6b5963690fc9be42eede47a60981310af12 | |
parent | 6a0fba4c609d6c2d8a2d4d330d05b36572947566 (diff) |
Add support for SIGINT/SIGTERM.
-rw-r--r-- | app/cwm/calmwm.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/app/cwm/calmwm.c b/app/cwm/calmwm.c index 6634d1ad4..002d3b20b 100644 --- a/app/cwm/calmwm.c +++ b/app/cwm/calmwm.c @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: calmwm.c,v 1.112 2020/02/27 14:56:39 okan Exp $ + * $OpenBSD: calmwm.c,v 1.113 2020/03/23 20:14:27 okan Exp $ */ #include <sys/types.h> @@ -89,11 +89,12 @@ main(int argc, char **argv) argc -= optind; argv += optind; - if (signal(SIGCHLD, sighdlr) == SIG_ERR) + if (signal(SIGCHLD, sighdlr) == SIG_ERR || + signal(SIGHUP, sighdlr) == SIG_ERR || + signal(SIGINT, sighdlr) == SIG_ERR || + signal(SIGTERM, sighdlr) == SIG_ERR) err(1, "signal"); - if (signal(SIGHUP, sighdlr) == SIG_ERR) - err(1, "signal"); - + if (parse_config(Conf.conf_file, &Conf) == -1) { warnx("error parsing config file"); if (nflag) @@ -216,6 +217,10 @@ sighdlr(int sig) case SIGHUP: cwm_status = CWM_EXEC_WM; break; + case SIGINT: + case SIGTERM: + cwm_status = CWM_QUIT; + break; } errno = save_errno; |