init: Make the log stream line-buffered
All checks were successful
continuous-integration/drone/push Build is passing

Looks like log output stopped showing after buffering was implemented, since the log was not flushed properly.
This commit is contained in:
apio 2023-07-24 11:54:49 +02:00
parent ad3f3bf4db
commit b3c478f19e
Signed by: apio
GPG Key ID: B8A7D06E42258954

View File

@ -328,13 +328,15 @@ int main()
umask(022);
g_init_log = fopen("/dev/uart0", "w+");
g_init_log = fopen("/dev/uart0", "w");
check(g_init_log);
setlinebuf(g_init_log);
fcntl(fileno(g_init_log), F_SETFD, FD_CLOEXEC);
set_hostname();
if (signal(SIGTERM, sigterm_handler) == SIG_ERR) do_log("[init] failed to register handler for SIGTERM");
if (signal(SIGQUIT, sigquit_handler) == SIG_ERR) do_log("[init] failed to register handler for SIGQUIT");
if (signal(SIGTERM, sigterm_handler) == SIG_ERR) do_log("[init] failed to register handler for SIGTERM\n");
if (signal(SIGQUIT, sigquit_handler) == SIG_ERR) do_log("[init] failed to register handler for SIGQUIT\n");
start_services();