From 3c14d26c4746768f1dc63d4b7ac0278a7abe5da1 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 7 Oct 2010 19:34:56 +0200 Subject: [PATCH] util: unify implementations of freeze() --- src/main.c | 5 ----- src/shutdown.c | 7 +------ src/util.c | 5 +++++ src/util.h | 2 ++ 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/main.c b/src/main.c index ee12e1f3a..6c65e64a2 100644 --- a/src/main.c +++ b/src/main.c @@ -73,11 +73,6 @@ static char *arg_console = NULL; static FILE* serialization = NULL; -_noreturn_ static void freeze(void) { - for (;;) - pause(); -} - static void nop_handler(int sig) { } diff --git a/src/shutdown.c b/src/shutdown.c index 023648c4c..b78c74112 100644 --- a/src/shutdown.c +++ b/src/shutdown.c @@ -40,11 +40,6 @@ #define FINALIZE_ATTEMPTS 50 #define FINALIZE_CRITICAL_ATTEMPTS 10 -_noreturn_ static void freeze(void) { - for (;;) - pause(); -} - static bool ignore_proc(pid_t pid) { if (pid == 1) return true; @@ -341,5 +336,5 @@ int main(int argc, char *argv[]) { r = -r; log_error("Critical error while doing system shutdown: %s", strerror(r)); freeze(); - return 0; + return EXIT_FAILURE; } diff --git a/src/util.c b/src/util.c index 98dbe28b5..85ee09d14 100644 --- a/src/util.c +++ b/src/util.c @@ -3308,6 +3308,11 @@ int wait_for_terminate_and_warn(const char *name, pid_t pid) { } +void freeze(void) { + for (;;) + pause(); +} + static const char *const ioprio_class_table[] = { [IOPRIO_CLASS_NONE] = "none", [IOPRIO_CLASS_RT] = "realtime", diff --git a/src/util.h b/src/util.h index 618e7cf9a..8a510ae5c 100644 --- a/src/util.h +++ b/src/util.h @@ -356,6 +356,8 @@ char *unquote(const char *s, const char *quotes); int wait_for_terminate(pid_t pid, siginfo_t *status); int wait_for_terminate_and_warn(const char *name, pid_t pid); +_noreturn_ void freeze(void); + #define NULSTR_FOREACH(i, l) \ for ((i) = (l); (i) && *(i); (i) = strchr((i), 0)+1) -- 2.30.2