From b4d2ab102b60759f4ff6e5678557af12f07e4a4f Mon Sep 17 00:00:00 2001 From: "Earle F. Philhower, III" Date: Tue, 7 Jan 2020 10:55:42 -0800 Subject: [PATCH] Fix boolean/logical & mixup in LittleFS open (#6996) To mimic SPIFFs behavior, we automatically create subdirectories when a file is opened in a subdir. The check mixed up a bitmask check with a boolean AND. Fix it. --- libraries/LittleFS/src/LittleFS.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/LittleFS/src/LittleFS.cpp b/libraries/LittleFS/src/LittleFS.cpp index 518ef663d..83041d222 100644 --- a/libraries/LittleFS/src/LittleFS.cpp +++ b/libraries/LittleFS/src/LittleFS.cpp @@ -52,7 +52,7 @@ FileImplPtr LittleFSImpl::open(const char* path, OpenMode openMode, AccessMode a int flags = _getFlags(openMode, accessMode); auto fd = std::make_shared(); - if ((openMode && OM_CREATE) && strchr(path, '/')) { + if ((openMode & OM_CREATE) && strchr(path, '/')) { // For file creation, silently make subdirs as needed. If any fail, // it will be caught by the real file open later on char *pathStr = strdup(path);