/* 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);
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");
*/
int llapi_hsm_register_event_fifo(const char *path)
{
- int rc;
int read_fd;
struct stat statbuf;
+ struct sigaction ignore_action;
+ int rc;
/* Create the FIFO if necessary. */
if ((mkfifo(path, 0644) < 0) && (errno != EEXIST)) {
}
/* Ignore SIGPIPEs -- can occur if the reader goes away. */
- signal(SIGPIPE, SIG_IGN);
+ memset(&ignore_action, 0, sizeof(ignore_action));
+ ignore_action.sa_handler = SIG_IGN;
+ sigemptyset(&ignore_action.sa_mask);
+ sigaction(SIGPIPE, &ignore_action, NULL);
return 0;
}