From 79157f299d4074387ce1dd050e3026911811d823 Mon Sep 17 00:00:00 2001 From: WangHan Date: Fri, 21 Nov 2025 21:09:59 +0800 Subject: [PATCH] add a warning message when file does not exist --- rock.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/rock.c b/rock.c index f080fdd..f701ace 100644 --- a/rock.c +++ b/rock.c @@ -1430,7 +1430,10 @@ int rock_flash_read_lba_to_file_progress(struct xrock_ctx_t * ctx, uint32_t sec, FILE * f = fopen(filename, "w"); if(!f) - return 0; + { + perror("Failed to open file for writing"); + exit(-1); + } if(cnt <= 65536) MAXSEC = 128; @@ -1481,7 +1484,10 @@ int rock_flash_write_lba_from_file_progress(struct xrock_ctx_t * ctx, uint32_t s FILE * f = fopen(filename, "r"); if(!f) - return 0; + { + perror("Failed to read file"); + exit(-1); + } fseek(f, 0, SEEK_END); int64_t len = ftell(f);