From db1e8983a0632938a4b6edcff0501136094e4144 Mon Sep 17 00:00:00 2001 From: Julian Uy Date: Sat, 29 Jul 2023 16:06:14 +0000 Subject: [PATCH] bdmfs_fatfs: do not rename if old and new path are same --- iop/fs/bdmfs_fatfs/src/fs_driver.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/iop/fs/bdmfs_fatfs/src/fs_driver.c b/iop/fs/bdmfs_fatfs/src/fs_driver.c index 04acf540156..8102ac0fd7f 100644 --- a/iop/fs/bdmfs_fatfs/src/fs_driver.c +++ b/iop/fs/bdmfs_fatfs/src/fs_driver.c @@ -751,6 +751,11 @@ int fs_rename(iop_file_t *fd, const char *path, const char *newpath) FATFS_FS_DRIVER_NAME_ALLOC_ON_STACK_IMPLEMENTATION(path, fd); FATFS_FS_DRIVER_NAME_ALLOC_ON_STACK_IMPLEMENTATION(newpath, fd); + // If old and new path are the same, no need to do anything + if (strcmp(modified_path, modified_newpath) == 0) { + return 0; + } + _fs_lock(); ret = f_rename(modified_path, modified_newpath);