diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2015-06-19 16:24:32 +0200 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2015-06-19 16:33:20 +0200 |
commit | 00d028fd7739ea1f4a49f1f3df6ce1dfb7188fe0 (patch) | |
tree | 6691bee12168eb33180354137113bbf8fc4f22fd /lib/log | |
parent | 3173442984dd8d31e43cb50db385f31c75cc9839 (diff) | |
download | lvm2-00d028fd7739ea1f4a49f1f3df6ce1dfb7188fe0.tar.gz |
log: flush stdout before print to stderr
Keep logging readable and fflush stdout before printing to stderr.
Diffstat (limited to 'lib/log')
-rw-r--r-- | lib/log/log.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/log/log.c b/lib/log/log.c index d8d65eed8..20ca29340 100644 --- a/lib/log/log.c +++ b/lib/log/log.c @@ -385,6 +385,8 @@ void print_log(int level, const char *file, int line, int dm_errno_or_class, default: /* Typically only log_warn goes to stdout */ stream = (use_stderr || (level != _LOG_WARN)) ? stderr : stdout; + if (stream == stderr) + fflush(stdout); fprintf(stream, "%s%s%s%s", buf, log_command_name(), _msg_prefix, indent_spaces); vfprintf(stream, trformat, ap); |