commit f3296add5bdbbb73f33c8f4b1576a24aae32924b from: Stefan Sperling via: Thomas Adam date: Wed Mar 01 14:29:45 2023 UTC gotd requires a config file; don't fail silently when gotd.conf cannot be read Fixes an issue encountered by mlarkin@ where the auth process was working with an empty list of repositories and kept saying it could not find a repository which was obviously listed in gotd.conf. Now we can see errors from fopen() in the logs instead. Old code was copied from gotwebd where the config file is optional. commit - f4204d57318d19f7a972ace5b15ba58f443e2c73 commit + f3296add5bdbbb73f33c8f4b1576a24aae32924b blob - 0394a37569c71ffd95c1fb0aeb7b1ed4b5eaf0a5 blob + 0989dea4289b2215cc3321897370367daf492ff9 --- gotd/parse.y +++ gotd/parse.y @@ -641,7 +641,7 @@ newfile(const char *name, int secret) } nfile->stream = fopen(nfile->name, "r"); if (nfile->stream == NULL) { - /* no warning, we don't require a conf file */ + log_warn("open %s", nfile->name); free(nfile->name); free(nfile); return (NULL); @@ -693,10 +693,8 @@ parse_config(const char *filename, enum gotd_procid pr gotd->request_timeout.tv_usec = 0; file = newfile(filename, 0); - if (file == NULL) { - /* just return, as we don't require a conf file */ - return (0); - } + if (file == NULL) + return -1; yyparse(); errors = file->errors;