mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-26 10:03:40 +03:00
main: when ignoring a signal set SA_RESTART
This commit is contained in:
parent
0d87eb4279
commit
a337c6fcee
4
main.c
4
main.c
@ -445,8 +445,8 @@ int main(int argc, char *argv[]) {
|
||||
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);
|
||||
|
11
util.c
11
util.c
@ -658,7 +658,6 @@ char *strstrip(char *s) {
|
||||
*s = 0;
|
||||
|
||||
return s;
|
||||
|
||||
}
|
||||
|
||||
char *delete_chars(char *s, const char *bad) {
|
||||
@ -1637,6 +1636,16 @@ int release_terminal(void) {
|
||||
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",
|
||||
|
Loading…
x
Reference in New Issue
Block a user