X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Finitctl.c;h=097c85fdd4c8c897a8912c95954c2a89d7d97ded;hb=4f3656e1cec7fe3d7d3537e23a406cb88d734502;hp=eaa717ad916bdb55115870696123397bb012759e;hpb=65457142f12ecc4bb39fad51b73b9d3e6eac4af5;p=elogind.git diff --git a/src/initctl.c b/src/initctl.c index eaa717ad9..097c85fdd 100644 --- a/src/initctl.c +++ b/src/initctl.c @@ -56,6 +56,8 @@ typedef struct Server { unsigned n_fifos; DBusConnection *bus; + + bool quit; } Server; struct Fifo { @@ -174,6 +176,13 @@ static void request_process(Server *s, const struct init_request *req) { case 'U': if (kill(1, SIGTERM) < 0) log_error("kill() failed: %m"); + + /* The bus connection will be + * terminated if PID 1 is reexecuted, + * hence let's just exit here, and + * rely on that we'll be restarted on + * the next request */ + s->quit = true; break; case 'q': @@ -404,7 +413,7 @@ int main(int argc, char *argv[]) { "READY=1\n" "STATUS=Processing requests..."); - for (;;) { + while (!server.quit) { struct epoll_event event; int k;