1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-21 10:26:06 +03:00

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.
This commit is contained in:
Earle F. Philhower, III 2020-01-07 10:55:42 -08:00 committed by GitHub
parent 8242d72271
commit b4d2ab102b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -52,7 +52,7 @@ FileImplPtr LittleFSImpl::open(const char* path, OpenMode openMode, AccessMode a
int flags = _getFlags(openMode, accessMode); int flags = _getFlags(openMode, accessMode);
auto fd = std::make_shared<lfs_file_t>(); 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, // For file creation, silently make subdirs as needed. If any fail,
// it will be caught by the real file open later on // it will be caught by the real file open later on
char *pathStr = strdup(path); char *pathStr = strdup(path);