Skip to content

Commit

Permalink
Apply SD.h fix from ESP8266
Browse files Browse the repository at this point in the history
Pull in the portion of the change correcting the flag setting from
esp8266/Arduino#8833
  • Loading branch information
earlephilhower committed Feb 11, 2023
1 parent b6cb2e7 commit 911a13e
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions libraries/SD/src/SD.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,23 @@ class SDClass {

private:
const char *getMode(uint8_t mode) {
bool read = (mode & O_READ) ? true : false;
bool write = (mode & O_WRITE) ? true : false;
bool append = (mode & O_APPEND) ? true : false;
bool read = false;
bool write = false;

switch (mode & O_ACCMODE) {
case O_RDONLY:
read = true;
break;
case O_WRONLY:
write = true;
break;
case O_RDWR:
read = true;
write = true;
break;
}
const bool append = (mode & O_APPEND) > 0;

if (read & !write) {
return "r";
} else if (!read & write & !append) {
Expand Down

0 comments on commit 911a13e

Please sign in to comment.