Skip to content

Commit

Permalink
Fix boolean/logical & mixup in LittleFS open (#6996)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
earlephilhower authored Jan 7, 2020
1 parent 8242d72 commit b4d2ab1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libraries/LittleFS/src/LittleFS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ FileImplPtr LittleFSImpl::open(const char* path, OpenMode openMode, AccessMode a
int flags = _getFlags(openMode, accessMode);
auto fd = std::make_shared<lfs_file_t>();

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);
Expand Down

0 comments on commit b4d2ab1

Please sign in to comment.