summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-09-23 01:32:44 +0200
committerLennart Poettering <lennart@poettering.net>2015-09-29 21:08:37 +0200
commit189d5bac5c45a6a735489541e285dec8bfc1d38d (patch)
tree955cf1bb252323c0f7720d88971de65ddbc0a290
parente6e242ad2d5f72573ceb4442242789aa23962cd2 (diff)
util: unify implementation of NOP signal handler
This is highly complex code after all, we really should make sure to only keep one implementation of this extremely difficult function around.
-rw-r--r--src/basic/util.c4
-rw-r--r--src/basic/util.h2
-rw-r--r--src/core/main.c4
-rw-r--r--src/nspawn/nspawn.c4
4 files changed, 8 insertions, 6 deletions
diff --git a/src/basic/util.c b/src/basic/util.c
index c788a1d58b..f7e4aefebb 100644
--- a/src/basic/util.c
+++ b/src/basic/util.c
@@ -6916,3 +6916,7 @@ int receive_one_fd(int transport_fd, int flags) {
return *(int*) CMSG_DATA(found);
}
+
+void nop_signal_handler(int sig) {
+ /* nothing here */
+}
diff --git a/src/basic/util.h b/src/basic/util.h
index e6417b4ccd..96811f23d9 100644
--- a/src/basic/util.h
+++ b/src/basic/util.h
@@ -944,3 +944,5 @@ int fgetxattr_malloc(int fd, const char *name, char **value);
int send_one_fd(int transport_fd, int fd, int flags);
int receive_one_fd(int transport_fd, int flags);
+
+void nop_signal_handler(int sig);
diff --git a/src/core/main.c b/src/core/main.c
index dac233e84d..76abb0bde9 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -115,8 +115,6 @@ static bool arg_default_blockio_accounting = false;
static bool arg_default_memory_accounting = false;
static bool arg_default_tasks_accounting = false;
-static void nop_handler(int sig) {}
-
static void pager_open_if_enabled(void) {
if (arg_no_pager <= 0)
@@ -134,7 +132,7 @@ noreturn static void crash(int sig) {
log_emergency("Caught <%s>, not dumping core.", signal_to_string(sig));
else {
struct sigaction sa = {
- .sa_handler = nop_handler,
+ .sa_handler = nop_signal_handler,
.sa_flags = SA_NOCLDSTOP|SA_RESTART,
};
pid_t pid;
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index cb4e87fd74..6b5d5d5b75 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -2282,8 +2282,6 @@ static int wait_for_container(pid_t pid, ContainerStatus *container) {
return r;
}
-static void nop_handler(int sig) {}
-
static int on_orderly_shutdown(sd_event_source *s, const struct signalfd_siginfo *si, void *userdata) {
pid_t pid;
@@ -3241,7 +3239,7 @@ int main(int argc, char *argv[]) {
ContainerStatus container_status;
_cleanup_(barrier_destroy) Barrier barrier = BARRIER_NULL;
static const struct sigaction sa = {
- .sa_handler = nop_handler,
+ .sa_handler = nop_signal_handler,
.sa_flags = SA_NOCLDSTOP,
};
int ifi = 0;