Commit c9055d07 authored by spiiroin's avatar spiiroin

[logging] Flush output streams relevant for logging

Mixed use of syslog, stdout, stderr and differences in buffering of
the streams causes the initial "starting up" message to end up as the
final output in usb-moded journal when debug level logging is used
(i.e. when freopen steps are skipped and stdout is not implicitly

Use stderr and flush it before potentially switching to syslog logging.
Signed-off-by: spiiroin's avatarSimo Piiroinen <>
parent 55794637
......@@ -1162,13 +1162,16 @@ int main(int argc, char* argv[])
printf("usb_moded %s starting\n", VERSION);
fprintf(stderr, "usb_moded %s starting\n", VERSION);
/* silence system() calls */
if(log_type != LOG_TO_STDERR || log_level != LOG_DEBUG )
freopen("/dev/null", "a", stdout);
freopen("/dev/null", "a", stderr);
#if !GLIB_CHECK_VERSION(2, 36, 0)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment