commit 3fa763e5f0869e218fa64750c375a84b706c6f92 from: Stefan Sperling date: Wed Mar 01 09:41:21 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 - b54930d53597467f9112f45e9bfd192e352531ac commit + 3fa763e5f0869e218fa64750c375a84b706c6f92 blob - 2a7768e3841b5f1a6bedaba38b27170496ecfceb blob + 7c1d70c3d90da2de044cf00d5ed56f0b3efae0c3 --- gotd/parse.y +++ gotd/parse.y @@ -643,7 +643,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); @@ -695,10 +695,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;