From 70662f57ea8b4a4821474bf7f6a55522ec507348 Mon Sep 17 00:00:00 2001 From: Zhang Sheng Date: Wed, 18 Jun 2025 22:01:17 +0800 Subject: [PATCH] wrudf-cmnd: Correct file descriptor check in copyFile function Updated the condition to check for a negative file descriptor when opening a file, ensuring proper error handling for non-existent files. --- wrudf/wrudf-cmnd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wrudf/wrudf-cmnd.c b/wrudf/wrudf-cmnd.c index 6abcb18..67a7d60 100644 --- a/wrudf/wrudf-cmnd.c +++ b/wrudf/wrudf-cmnd.c @@ -56,7 +56,7 @@ copyFile(Directory *dir, char* inName, char*newName, struct stat *fileStat) uint8_t p[2048]; fd = open(inName, O_RDONLY); - if( fd == 0 ) { + if( fd < 0 ) { printf("'%s' does not exist\n", inName); return CMND_FAILED; }