Fix 2006/stewart - check if FILE * == NULL
This commit is contained in:
1 parent
9f4f0981e0
commit
544f154694
3 files changed
+6
-16
No files matched your search
@@ -10,17 +10,6 @@ make
|
||||
```
|
||||
|
||||
|
||||
### Bugs and (Mis)features
|
||||
|
||||
The current status of this entry is:
|
||||
|
||||
```
|
||||
STATUS: known bug - please help us fix
|
||||
```
|
||||
|
||||
For more detailed information see [2006 stewart in bugs.md](/bugs.md#2006-stewart).
|
||||
|
||||
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
@@ -48,11 +37,6 @@ where `FILE` is one of:
|
||||
spirals4 squares stars stars2 tree tree2 tree3 tree4 triangle
|
||||
|
||||
|
||||
### INABIAF - it's not a bug it's a feature! :-)
|
||||
|
||||
This program will very likely crash or do something funny if the file does not
|
||||
exist or cannot be opened.
|
||||
|
||||
## Judges' remarks:
|
||||
|
||||
Note the interesting choice of using a `#define` in the output.
|
||||
|
||||
@@ -20,6 +20,7 @@ int main(int c,char**o)
|
||||
Z(v,6)=(long)malloc(Z(v,0));
|
||||
memset((void*)Z(v,6),0,Z(v,0));
|
||||
Z(v,13)=(long)fopen(o[3],"r");
|
||||
if(F(v,13)==NULL)P("file doesn't exist\n"), exit(1);
|
||||
fscanf(F(v,13),"%ld",(long*)Y(v,3));
|
||||
Z(v,8)=(long)malloc(050+Z(v,3)*070);
|
||||
Z(Z(v,8),0)=Z(v,3);
|
||||
|
||||
@@ -2154,6 +2154,11 @@ Since the author suggested that the lack of certain `#include`s might break the
|
||||
program in some systems he added `-include ...` to the Makefile as well.
|
||||
|
||||
|
||||
## [2006/stewart](2006/stewart/stewart.c) ([README.md](2006/stewart/README.md]))
|
||||
|
||||
Cody fixed it so that if the file cannot be opened it exits rather than trying
|
||||
to read from the file.
|
||||
|
||||
## [2006/toledo2](2006/toledo2/toledo2.c) ([README.md](2006/toledo2/README.md]))
|
||||
|
||||
Cody fixed a segfault in this program which was making it fail to work under
|
||||
|
||||
Reference in new issue
Block a user