fiss

Friedel's Initialization and Service Supervision
Log | Files | Refs | LICENSE

commit efd2e16f5ca9948f765e74cb2f59efb8c2b1ed80
parent 2e1bc8d6cbca25ba71bc3dd72cc8e2f6c8a0ffe7
Author: Friedel Schön <[email protected]>
Date:   Tue, 23 May 2023 22:12:01 +0200

formatting and refactor finit

Diffstat:
Msrc/exec/finit.c | 15+++++----------
1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/src/exec/finit.c b/src/exec/finit.c @@ -39,7 +39,6 @@ static void signal_interrupt(int signum) { int main(int argc, const char** argv) { - int ttyfd; sigset_t ss; if (getpid() != 1) { @@ -88,26 +87,23 @@ int main(int argc, const char** argv) { sync(); reboot(RB_AUTOBOOT); } else { -# ifdef RB_POWER_OFF +# if defined(RB_POWER_OFF) printf("system power off\n"); sync(); reboot(RB_POWER_OFF); sleep(2); -# endif -# ifdef RB_HALT_SYSTEM +# elif defined(RB_HALT_SYSTEM) printf("system halt\n"); sync(); reboot(RB_HALT_SYSTEM); -# else -# ifdef RB_HALT +# elif define(RB_HALT) printf("system halt\n"); sync(); reboot(RB_HALT); -# else +# else printf("system reboot\n"); sync(); reboot(RB_AUTOBOOT); -# endif # endif } if (pid == 0) @@ -117,8 +113,7 @@ int main(int argc, const char** argv) { sigaddset(&ss, SIGCHLD); sigprocmask(SIG_UNBLOCK, &ss, NULL); - while (waitpid(pid, NULL, 0) == -1) - ; + while (waitpid(pid, NULL, 0) != -1) {} } #endif