arduino-libraries / SD

SD Library for Arduino
http://arduino.cc/
GNU General Public License v3.0
182 stars 155 forks source link

Do not expose internal SD.root to sketches with SD.open("/") #40

Closed cmaglie closed 6 years ago

cmaglie commented 7 years ago

Cherry-picked from @PaulStoffregen's: https://github.com/arduino/Arduino/pull/3647 Fixes https://github.com/arduino-libraries/SD/issues/39

Discussion here: https://groups.google.com/a/arduino.cc/d/msg/developers/jWsi7A_g-Mk/Q2sFpzDDBQAJ

PaulStoffregen commented 6 years ago

I know this is probably a very low priority for Arduino, since most very simple programs don't hit this bug.

Still, it's not good practice to have a persistent SdFile for the root folder which sketches can access and leave in any state, causing future SD.open() to fail.

cmaglie commented 6 years ago

Tested and working great! Thank you!