LibC: Don't assert on unknown mode character in fopen()

Just carry on with some debug log whining.
Gets rid of one dropbear patch. :^)
This commit is contained in:
Andreas Kling 2020-06-08 21:57:13 +02:00
commit a85506009f
Notes: sideshowbarker 2024-07-19 05:44:23 +09:00
2 changed files with 3 additions and 15 deletions

View file

@ -913,8 +913,8 @@ static int parse_mode(const char* mode)
// NOTE: rt is a non-standard mode which opens a file for read, explicitly
// specifying that it's a text file
for (; *mode; ++mode) {
switch (*mode) {
for (auto* ptr = mode; *ptr; ++ptr) {
switch (*ptr) {
case 'r':
flags |= O_RDONLY;
break;
@ -937,8 +937,7 @@ static int parse_mode(const char* mode)
// Ok...
break;
default:
dbg() << "Unsupported mode _" << mode << "_ (because of '" << *mode << "')";
ASSERT_NOT_REACHED();
dbg() << "Potentially unsupported fopen mode _" << mode << "_ (because of '" << *ptr << "')";
}
}