]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-master: Set process title to [initializing] until master_service_init_finish()
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Fri, 24 Mar 2023 00:00:37 +0000 (02:00 +0200)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Sun, 14 May 2023 17:52:36 +0000 (17:52 +0000)
src/lib-master/master-service.c

index a92c0a8d66763874c24ccf5fc45e4e561f83bc60..a7f546743f60ec437fea7f3d9b8c1213fd029aab 100644 (file)
@@ -268,6 +268,9 @@ master_service_init(const char *name, enum master_service_flags flags,
                flags |= MASTER_SERVICE_FLAG_STANDALONE;
 
        process_title_init(*argc, argv);
+       if ((flags & MASTER_SERVICE_FLAG_STANDALONE) == 0 &&
+           getenv(MASTER_VERBOSE_PROCTITLE_ENV) != NULL)
+               process_title_set("[initializing]");
 
        /* process_title_init() might destroy all environments.
           Need to look this up again. */
@@ -703,6 +706,12 @@ void master_service_init_finish(struct master_service *service)
                if (!t_pop(&service->datastack_frame_id))
                        i_panic("Leaked t_pop() call");
        }
+       /* If nothing else has updated the process title yet, it should still
+          be [initializing]. Remove it here. */
+       if ((service->flags & MASTER_SERVICE_FLAG_STANDALONE) == 0 &&
+           process_title_get_counter() == 1 &&
+           getenv(MASTER_VERBOSE_PROCTITLE_ENV) != NULL)
+               process_title_set("");
 }
 
 static void master_service_import_environment_real(const char *import_environment)