mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:27:35 +00:00
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:
parent
c88ea2f54a
commit
a85506009f
2 changed files with 3 additions and 15 deletions
|
@ -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
|
// NOTE: rt is a non-standard mode which opens a file for read, explicitly
|
||||||
// specifying that it's a text file
|
// specifying that it's a text file
|
||||||
for (; *mode; ++mode) {
|
for (auto* ptr = mode; *ptr; ++ptr) {
|
||||||
switch (*mode) {
|
switch (*ptr) {
|
||||||
case 'r':
|
case 'r':
|
||||||
flags |= O_RDONLY;
|
flags |= O_RDONLY;
|
||||||
break;
|
break;
|
||||||
|
@ -937,8 +937,7 @@ static int parse_mode(const char* mode)
|
||||||
// Ok...
|
// Ok...
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
dbg() << "Unsupported mode _" << mode << "_ (because of '" << *mode << "')";
|
dbg() << "Potentially unsupported fopen mode _" << mode << "_ (because of '" << *ptr << "')";
|
||||||
ASSERT_NOT_REACHED();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
--- a/compat.c
|
|
||||||
+++ b/compat.c
|
|
||||||
@@ -244,7 +244,7 @@
|
|
||||||
if (strings != NULL)
|
|
||||||
free(strings);
|
|
||||||
strings = NULL;
|
|
||||||
- if ((fp = fopen("/etc/shells", "rc")) == NULL)
|
|
||||||
+ if ((fp = fopen("/etc/shells", "r")) == NULL)
|
|
||||||
return (char **) okshells;
|
|
||||||
if (fstat(fileno(fp), &statb) == -1) {
|
|
||||||
(void)fclose(fp);
|
|
Loading…
Add table
Add a link
Reference in a new issue