This is an automated email from the ASF dual-hosted git repository.

jerzy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
     new 12fd9e7b9 fs/littlefs: Fix open functions
12fd9e7b9 is described below

commit 12fd9e7b94698127c6cc3296f52e02f9953eb9a9
Author: Jerzy Kasenberg <[email protected]>
AuthorDate: Sat Jun 21 10:55:33 2025 +0200

    fs/littlefs: Fix open functions
    
    RDRW was chosen if either read or write was requested.
    Now LFS_O_RDRW is selected correctly
    
    Signed-off-by: Jerzy Kasenberg <[email protected]>
---
 fs/littlefs/src/mynewt_glue.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/littlefs/src/mynewt_glue.c b/fs/littlefs/src/mynewt_glue.c
index 75755118d..9f269d852 100644
--- a/fs/littlefs/src/mynewt_glue.c
+++ b/fs/littlefs/src/mynewt_glue.c
@@ -303,7 +303,8 @@ littlefs_open(const char *path, uint8_t access_flags, 
struct fs_file **out_fs_fi
      */
 
     flags = 0;
-    if (access_flags & (FS_ACCESS_READ | FS_ACCESS_WRITE)) {
+    if ((access_flags & (FS_ACCESS_READ | FS_ACCESS_WRITE)) ==
+        (FS_ACCESS_READ | FS_ACCESS_WRITE)) {
         flags |= LFS_O_RDWR;
     } else if (access_flags & FS_ACCESS_READ) {
         flags |= LFS_O_RDONLY;

Reply via email to