assert_se(reset_all_signal_handlers() == 0);
/* If we are init, we can block sigkill. Yay. */
- signal(SIGKILL, SIG_IGN);
- signal(SIGPIPE, SIG_IGN);
+ ignore_signal(SIGKILL);
+ ignore_signal(SIGPIPE);
/* Close all open files */
assert_se(close_all_fds(NULL, 0) == 0);
*s = 0;
return s;
-
}
char *delete_chars(char *s, const char *bad) {
return r;
}
+int ignore_signal(int sig) {
+ struct sigaction sa;
+
+ zero(sa);
+ sa.sa_handler = SIG_IGN;
+ sa.sa_flags = SA_RESTART;
+
+ return sigaction(sig, &sa, NULL);
+}
+
static const char *const ioprio_class_table[] = {
[IOPRIO_CLASS_NONE] = "none",
[IOPRIO_CLASS_RT] = "realtime",
int flush_fd(int fd);
+int ignore_signal(int sig);
+
extern char * __progname;
const char *ioprio_class_to_string(int i);