static void error_exit(const char *str) NORETURN;
static void error_exit(const char *str)
{
- //release all acquired resources
+ /* Release all acquired resources */
shmdt(shbuf);
bb_perror_msg_and_die(str);
}
error_exit("semop[SMrup]");
}
-static void interrupted(int sig UNUSED_PARAM)
+static void interrupted(int sig)
{
- signal(SIGINT, SIG_IGN);
shmdt(shbuf);
- exit(EXIT_SUCCESS);
+ kill_myself_with_sig(sig);
}
int logread_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
if (log_semid == -1)
error_exit("can't get access to semaphores for syslogd buffer");
- signal(SIGINT, interrupted);
+ bb_signals(BB_FATAL_SIGS, interrupted);
/* Suppose atomic memory read */
/* Max possible value for tail is shbuf->size - 1 */