From 4431c46a7b953d3e9b6711f14c2e56a9834d8608 Mon Sep 17 00:00:00 2001 From: d0k3 Date: Thu, 8 Dec 2016 23:36:18 +0100 Subject: [PATCH] Handle write protected files as images --- source/fatfs/image.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/fatfs/image.c b/source/fatfs/image.c index 2bf3c02..42cb2ac 100644 --- a/source/fatfs/image.c +++ b/source/fatfs/image.c @@ -94,7 +94,8 @@ u32 MountImage(const char* path) { *mount_path = 0; } if (!type) return 0; - if (fx_open(&mount_file, path, FA_READ | FA_WRITE | FA_OPEN_EXISTING) != FR_OK) + if ((fx_open(&mount_file, path, FA_READ | FA_WRITE | FA_OPEN_EXISTING) != FR_OK) && + (fx_open(&mount_file, path, FA_READ | FA_OPEN_EXISTING) != FR_OK)) return 0; f_lseek(&mount_file, 0); f_sync(&mount_file);