From 1e26ff4dc7a7a906debddbe1a7db0dbfa4a383aa Mon Sep 17 00:00:00 2001 From: Karol Trzcinski Date: Fri, 25 Sep 2020 08:28:25 +0200 Subject: [PATCH] logger: Use 'rb' mode for freopen Windows platform needs "rb" mode to read binary file, otherwise after read 0x1A EOF will be. See: https://stackoverflow.com/questions/11717120/unexpected-return-value-from-fread Signed-off-by: Karol Trzcinski --- tools/logger/convert.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/logger/convert.c b/tools/logger/convert.c index 711aaac27..0a1277c32 100644 --- a/tools/logger/convert.c +++ b/tools/logger/convert.c @@ -640,7 +640,7 @@ static int logger_read(void) ret = fread(&dma_log, sizeof(dma_log), 1, global_config->in_fd); if (!ret) { if (global_config->trace && !ferror(global_config->in_fd)) { - if (freopen(NULL, "r", global_config->in_fd)) { + if (freopen(NULL, "rb", global_config->in_fd)) { continue; } else { log_err("in %s(), freopen(..., %s) failed: %s(%d)\n",