Skip to content

Commit 3241ffe

Browse files
committed
2 parents cdb9525 + f5be15b commit 3241ffe

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

  • ArduinoCore-Linux/libraries

‎ArduinoCore-Linux/libraries/SD.h‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,29 @@
4545
#define SPI_EIGHTH_SPEED SD_SCK_MHZ(1)
4646
#define SPI_SIXTEENTH_SPEED SD_SCK_HZ(500000)
4747

48+
// These reuse POSIX's O_* names for unrelated std::ios::openmode values, so
49+
// they must win over <fcntl.h>'s real O_* macros (already pulled in
50+
// transitively by this point on some platforms, e.g. via std::fstream/
51+
// networking headers included before this file) - #undef first rather
52+
// than #ifndef-guarding, since guarding would leave the real POSIX values
53+
// in effect and silently break File::open().
54+
#undef O_RDONLY
4855
#define O_RDONLY ios::in ///< Open for reading only.
56+
#undef O_WRONLY
4957
#define O_WRONLY ios::out ///< Open for writing only.
58+
#undef O_RDWR
5059
#define O_RDWR ios::in | ios::out ///< Open for reading and writing.
60+
#undef O_AT_END
5161
#define O_AT_END ios::ate ///< Open at EOF.
62+
#undef O_APPEND
5263
#define O_APPEND ios::ate ///< Set append mode.
64+
#undef O_CREAT
5365
#define O_CREAT ios::trunc ///< Create file if it does not exist.
66+
#undef O_TRUNC
5467
#define O_TRUNC ios::trunc ///< Truncate file to zero length.
68+
#undef O_EXCL
5569
#define O_EXCL 0 ///< Fail if the file exists.
70+
#undef O_SYNC
5671
#define O_SYNC 0 ///< Synchronized write I/O operations.
5772
#define O_READ O_RDONLY
5873
#define O_WRITE O_WRONLY

0 commit comments

Comments
 (0)