[cat] handle load failure without seg faulting
This commit is contained in:
parent
ed31c2cbea
commit
ee1ade379f
@ -9,6 +9,9 @@ int main(int argc, char ** argv) {
|
|||||||
FILE * fd = stdin;
|
FILE * fd = stdin;
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
fd = fopen(argv[1], "r");
|
fd = fopen(argv[1], "r");
|
||||||
|
if (!fd) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t length;
|
size_t length;
|
||||||
|
Loading…
Reference in New Issue
Block a user