X-Git-Url: https://git.distorted.org.uk/~mdw/yaid/blobdiff_plain/223e3e2be7a30ab58804b9b741c9438b123a16fd..17272ab8669aa3061b08de9862ea1e9086b8b540:/policy.c diff --git a/policy.c b/policy.c index 32a4550..57ce979 100644 --- a/policy.c +++ b/policy.c @@ -443,13 +443,15 @@ fail: * formatting error messages for the log. */ int open_policy_file(struct policy_file *pf, const char *name, - const char *what, const struct query *q) + const char *what, const struct query *q, unsigned f) { struct stat st; if ((pf->fp = fopen(name, "r")) == 0) { - logmsg(q, LOG_ERR, "failed to open %s `%s': %s", - what, name, strerror(errno)); + if (errno != ENOENT || !(f & OPF_NOENTOK)) { + logmsg(q, LOG_ERR, "failed to open %s `%s': %s", + what, name, strerror(errno)); + } goto err_0; } @@ -529,7 +531,7 @@ int load_policy_file(const char *file, policy_v *pv) struct policy_file pf; policy_v v = DA_INIT; - if (open_policy_file(&pf, file, "policy file", 0)) + if (open_policy_file(&pf, file, "policy file", 0, 0)) return (-1); while (!read_policy_file(&pf)) { DA_PUSH(&v, pf.p);