diff options
author | Leah Neukirchen <leah@vuxu.org> | 2022-01-27 17:25:02 +0100 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2022-01-27 17:25:02 +0100 |
commit | d67388e986f1724b804d602040b82715116f3f7d (patch) | |
tree | 01519d02dad5cfd7c56b8713707b8dd71dc1a806 | |
parent | d3e94f8422a720471ccc546094991a3493b205dc (diff) | |
download | rvnit-d67388e986f1724b804d602040b82715116f3f7d.tar.gz rvnit-d67388e986f1724b804d602040b82715116f3f7d.tar.xz rvnit-d67388e986f1724b804d602040b82715116f3f7d.zip |
allow shutdown during bringup
-rw-r--r-- | rvnit.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/rvnit.c b/rvnit.c index 75b55d5..f49fdd3 100644 --- a/rvnit.c +++ b/rvnit.c @@ -726,7 +726,7 @@ main(int argc, char *argv[]) #endif int i; - for (level = 0; level < 100; level++) { + for (level = 0; level < 100 && !want_shutdown; level++) { /* spawn all of level */ int oneshot = 0; @@ -764,12 +764,16 @@ main(int argc, char *argv[]) pthread_mutex_unlock(&services_lock); - while (oneshot) { + while (oneshot && !want_shutdown) { int status = 0; int pid = wait(&status); - if (pid < 0 && errno == ECHILD) - break; + if (pid < 0) { + if (errno == ECHILD) + break; + else + continue; + } pthread_mutex_lock(&services_lock); @@ -813,10 +817,7 @@ cont1: LOG("system up"); - while (1) { - if (want_shutdown) - break; - + while (!want_shutdown) { if (want_rescandir) { pthread_mutex_lock(&services_lock); rescandir(); |