mirror of
https://github.com/RGBCube/serenity
synced 2025-05-18 08:25:07 +00:00
Userland: Add fopen error handling to less
This commit is contained in:
parent
2e4be5e98c
commit
821b752993
1 changed files with 3 additions and 2 deletions
|
@ -331,8 +331,9 @@ int main(int argc, char** argv)
|
||||||
FILE* file;
|
FILE* file;
|
||||||
if (String("-") == filename) {
|
if (String("-") == filename) {
|
||||||
file = stdin;
|
file = stdin;
|
||||||
} else {
|
} else if ((file = fopen(filename, "r")) == nullptr) {
|
||||||
file = fopen(filename, "r");
|
perror("fopen");
|
||||||
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pledge("stdio tty", nullptr) < 0) {
|
if (pledge("stdio tty", nullptr) < 0) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue