mirror of https://github.com/thesofproject/sof.git
logger: Log fread error only when it happened
fread may return 0 when some error occurred or nothig has been reded. Moreover errno may not be set on Windows plaform, use ferror instead. See: https://www.gnu.org/software/gnulib/manual/html_node/fread.html Fixes: 337afc4f3809: ("logger: add error message when reading sof/etrace instead of sof/trace") Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
This commit is contained in:
parent
d477a83aaa
commit
5eb9c49258
|
@ -640,10 +640,12 @@ static int logger_read(void)
|
|||
return -errno;
|
||||
}
|
||||
}
|
||||
log_err("in %s(), fread(..., %s) failed: %s(%d)\n",
|
||||
__func__, global_config->in_file,
|
||||
strerror(errno), errno);
|
||||
return -errno;
|
||||
ret = -ferror(global_config->in_fd);
|
||||
if (ret)
|
||||
log_err("in %s(), fread(..., %s) failed: %s(%d)\n",
|
||||
__func__, global_config->in_file,
|
||||
strerror(-ret), ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* checking if received trace address is located in
|
||||
|
|
Loading…
Reference in New Issue