X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Futils%2Flhsmtool_posix.c;h=d99fce3c87512f9fc6fac8bb902dc711a9342744;hp=fdf63c89920c6e8f013ec392b9383d5484bf9fbb;hb=5fbb786b96b7db3a977dd8a8fca9a40f52f66b82;hpb=3c94dc6c6156054293f1e794294036940ee5d578;ds=sidebyside diff --git a/lustre/utils/lhsmtool_posix.c b/lustre/utils/lhsmtool_posix.c index fdf63c8..d99fce3 100644 --- a/lustre/utils/lhsmtool_posix.c +++ b/lustre/utils/lhsmtool_posix.c @@ -1790,7 +1790,8 @@ static void handler(int signal) /* Daemon waits for messages from the kernel; run it in the background. */ static int ct_run(void) { - int rc; + struct sigaction cleanup_sigaction; + int rc; if (opt.o_daemonize) { rc = daemon(1, 1); @@ -1820,14 +1821,17 @@ static int ct_run(void) return rc; } - signal(SIGINT, handler); - signal(SIGTERM, handler); + memset(&cleanup_sigaction, 0, sizeof(cleanup_sigaction)); + cleanup_sigaction.sa_handler = handler; + sigemptyset(&cleanup_sigaction.sa_mask); + sigaction(SIGINT, &cleanup_sigaction, NULL); + sigaction(SIGTERM, &cleanup_sigaction, NULL); while (1) { - struct hsm_action_list *hal; - struct hsm_action_item *hai; - int msgsize; - int i = 0; + struct hsm_action_list *hal; + struct hsm_action_item *hai; + int msgsize; + int i = 0; CT_TRACE("waiting for message from kernel");