style: apply clang-format and const qualifiers from master

This commit is contained in:
2026-03-09 12:54:55 +03:00
parent 507ef91b5f
commit 06463b75b4
7 changed files with 81 additions and 68 deletions

View File

@@ -377,11 +377,6 @@ init_prof_test(void **state)
"[notifications]\n"
"message=false\n"
"room=false\n");
const char *flatfile_env = getenv("PROF_FLATFILE");
if (flatfile_env && strcmp(flatfile_env, "1") == 0) {
fprintf(prc, "[logging]\ndblog=flatfile\n");
printf("[PROF_TEST] Wrote profrc with dblog=flatfile: %s\n", profrc_path);
}
fclose(prc);
}
@@ -441,17 +436,33 @@ prof_stop(void)
{
if (fd > 0 && child_pid > 0) {
prof_input("/quit");
sleep(1);
waitpid(child_pid, NULL, 0);
sleep_ms(QUIT_GRACE_MS);
close(fd);
fd = 0;
int exited = 0;
for (int i = 0; i < SHUTDOWN_POLL_MAX; i++) {
if (waitpid(child_pid, NULL, WNOHANG) != 0) {
exited = 1;
break;
}
sleep_ms(SHUTDOWN_POLL_MS);
}
if (!exited) {
kill(child_pid, SIGTERM);
for (int i = 0; i < SIGTERM_POLL_MAX; i++) {
if (waitpid(child_pid, NULL, WNOHANG) != 0) { exited = 1; break; }
sleep_ms(SHUTDOWN_POLL_MS);
}
if (!exited) {
kill(child_pid, SIGKILL);
waitpid(child_pid, NULL, 0);
}
}
child_pid = 0;
}
/* Reset output buffer for clean restart */
output_len = 0;
output_buffer[0] = '\0';
/* Brief delay to let stabber release old connection state */
usleep(200000); /* 200ms */
}
void