From b5182e09d015029f8fce83a0e787355540a406c1 Mon Sep 17 00:00:00 2001 From: Uwe Bonnes Date: Sat, 25 Apr 2020 13:15:31 +0200 Subject: [PATCH] cl_utils: When reading from flash to file, truncate the file. --- src/platforms/pc/cl_utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platforms/pc/cl_utils.c b/src/platforms/pc/cl_utils.c index 114fd9e..57af8d3 100644 --- a/src/platforms/pc/cl_utils.c +++ b/src/platforms/pc/cl_utils.c @@ -306,7 +306,7 @@ int cl_execute(BMP_CL_OPTIONS_t *opt) } } else if (opt->opt_mode == BMP_MODE_FLASH_READ) { /* Open as binary */ - read_file = open(opt->opt_flash_file, O_CREAT | O_RDWR | O_BINARY, + read_file = open(opt->opt_flash_file, O_TRUNC | O_CREAT | O_RDWR | O_BINARY, S_IRUSR | S_IWUSR); if (read_file == -1) { printf("Error opening flashfile %s for read: %s\n",