This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new fe45d8aace fs/spiffs: Return OK on `spiffs_[f]stat` success
fe45d8aace is described below
commit fe45d8aace2683b212e4ca2b9166a5df93c760fe
Author: Tiago Medicci <[email protected]>
AuthorDate: Tue Jul 30 09:50:05 2024 -0300
fs/spiffs: Return OK on `spiffs_[f]stat` success
According to the POSIX standard, `fstat` and `stat` should return 0
(`OK`) on success. This commit changed the underlying `spiffs`
implementation to follow the POSIX standard.
---
fs/spiffs/src/spiffs_vfs.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/fs/spiffs/src/spiffs_vfs.c b/fs/spiffs/src/spiffs_vfs.c
index f8e6967a45..e950db426b 100644
--- a/fs/spiffs/src/spiffs_vfs.c
+++ b/fs/spiffs/src/spiffs_vfs.c
@@ -1187,7 +1187,10 @@ static int spiffs_fstat(FAR const struct file *filep,
FAR struct stat *buf)
}
spiffs_unlock_volume(fs);
- return spiffs_map_errno(ret);
+
+ ret = spiffs_map_errno(ret);
+
+ return ret >= 0 ? OK : ret;
}
/****************************************************************************
@@ -1929,7 +1932,8 @@ static int spiffs_stat(FAR struct inode *mountpt, FAR
const char *relpath,
errout_with_lock:
spiffs_unlock_volume(fs);
- return spiffs_map_errno(ret);
+ ret = spiffs_map_errno(ret);
+ return ret >= 0 ? OK : ret;
}
/****************************************************************************