fixbug: setproctitle when main_ctx_init not called before
@@ -283,8 +283,10 @@ const char* get_env(const char* key) {
void setproctitle(const char* title) {
//printf("proctitle=%s\n", title);
int len = g_main_ctx.arg_len + g_main_ctx.env_len;
+ if (g_main_ctx.os_argv && len) {
strncpy(g_main_ctx.os_argv[0], title, len-1);
}
+}
#endif
int create_pidfile() {
