tools: logger: Skip double error logs to stdout

When out_fd points standard output then error message shouldn't be
duplicated - duplicated messages only make logger output more messy.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
This commit is contained in:
Karol Trzcinski 2020-03-23 07:15:45 +01:00 committed by Lech Betlej
parent 11b9ca19cb
commit 354ff5ccf9
1 changed files with 3 additions and 1 deletions

View File

@ -68,7 +68,9 @@ static void log_err(FILE *out_fd, const char *fmt, ...)
if (buff) { if (buff) {
vsprintf(buff, fmt, args); vsprintf(buff, fmt, args);
fprintf(stderr, "%s", buff); fprintf(stderr, "%s", buff);
if (out_fd) {
/* take care about out_fd validity and duplicated logging */
if (out_fd && out_fd != stderr && out_fd != stdout) {
fprintf(out_fd, "%s", buff); fprintf(out_fd, "%s", buff);
fflush(out_fd); fflush(out_fd);
} }