getenv: treat a read error like eof

Otherwise, the following would occur:
 * settings.toml is in the process of being written by host computer
 * soft-reset begins
 * web workflow tries to grab CIRCUITPY_WIFI_SSID, but loops forever
   because FAT filesystem is in inconsistent state and file reads error
 * settings.toml write by host computer never completes and the filesystem
   remains corrupt
 * restarting yields a soft-bricked device, because startup reads
   CIRCUITPY_WIFI_SSID again
This commit is contained in:
Jeff Epler 2023-03-29 10:03:56 -05:00
parent 4517071e6f
commit cc3d0f6fa1
No known key found for this signature in database
GPG Key ID: D5BF15AB975AB4DE

View File

@ -72,7 +72,7 @@ STATIC void close_file(file_arg *active_file) {
// nothing // nothing
} }
STATIC bool is_eof(file_arg *active_file) { STATIC bool is_eof(file_arg *active_file) {
return f_eof(active_file); return f_eof(active_file) | f_error(active_file);
} }
// Return 0 if there is no next character (EOF). // Return 0 if there is no next character (EOF).