Commit Diff
Diff:
ef352ec3b87210945429d033625bbfb06de4d7c4
83272dfee9eb5292ce21de55ebdbb3876a37fcb1
Commit:
83272dfee9eb5292ce21de55ebdbb3876a37fcb1
Tree:
6e676adc68050a00761cf7c4dbb2e147e8e44a3a
Author:
Omar Polo <op@omarpolo.com>
Date:
Mon Aug 23 22:42:59 2021 UTC
Message:
don't yyerror if we can't open the file

the global var file could still be NULL and yyerror would crash.
commit - ef352ec3b87210945429d033625bbfb06de4d7c4
commit + 83272dfee9eb5292ce21de55ebdbb3876a37fcb1
blob - 8d3177732c7455ae587bca87b8fca95785bc3a7d
blob + 54282a36b33c7144b66bf3b0984a1efb84c0e595
--- parse.y
+++ parse.y
@@ -752,7 +752,7 @@ pushfile(const char *name, int secret)
nfile = xcalloc(1, sizeof(*nfile));
nfile->name = xstrdup(name);
if ((nfile->stream = fopen(nfile->name, "r")) == NULL) {
- yyerror("can't open %s: %s", nfile->name,
+ log_warn(NULL, "can't open %s: %s", nfile->name,
strerror(errno));
free(nfile->name);
free(nfile);
@@ -789,7 +789,7 @@ parse_conf(const char *filename)
file = pushfile(filename, 0);
if (file == NULL)
- return;
+ exit(1);
topfile = file;
yyparse();
Omar Polo