]> 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>
Mon, 27 Mar 2023 18:03:20 +0000 (18:03 +0000)
src/lib-master/master-service.c

index 308b56ffc631b41a8bf44333a1763d0a58d0af10..4ef0645c03f571d0ad4d78a99786d9cded26f5b5 100644 (file)
@@ -490,6 +490,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. */
@@ -948,6 +951,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)