summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2022-10-18 00:36:49 +0100
committerColin Watson <cjwatson@debian.org>2022-10-18 00:36:49 +0100
commit20f048d1b4303158f61d7e88330f6c5b53a82b81 (patch)
tree15ac223ed78341682e9fe54e02b4fc4843f9008c
parent71aefedddd2c1156c5cea8ebd27debc4e23b458a (diff)
Silence error for empty mandir with missing catdir
Fixes https://gitlab.com/cjwatson/man-db/-/issues/8. * src/check_mandirs.c (ensure_db_open): Don't call `gripe_rwopen_failed` before returning false (since it only makes sense for one of the two callers). (testmandirs): Call `gripe_rwopen_failed` if `ensure_db_open` returns false.
-rw-r--r--NEWS.md2
-rw-r--r--src/check_mandirs.c5
2 files changed, 4 insertions, 3 deletions
diff --git a/NEWS.md b/NEWS.md
index bbf1b050..5ecb87d4 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -5,6 +5,8 @@ Fixes:
* SECURITY: Escape `$` characters in page names when constructing `less`
prompts. Note that this requires `less` >= 457 (released in 2012).
+ * Silence error message when processing an empty manual page hierarchy with
+ a nonexistent cache directory.
Improvements:
diff --git a/src/check_mandirs.c b/src/check_mandirs.c
index 8ed87d7f..75c6f5e2 100644
--- a/src/check_mandirs.c
+++ b/src/check_mandirs.c
@@ -141,10 +141,8 @@ static bool ensure_db_open (MYDBM_FILE dbf)
{
if (dbf->file)
return true;
- if (!MYDBM_RWOPEN (dbf)) {
- gripe_rwopen_failed (dbf);
+ if (!MYDBM_RWOPEN (dbf))
return false;
- }
return true;
}
@@ -558,6 +556,7 @@ static int testmandirs (MYDBM_FILE dbf, const char *path, const char *catpath,
created = true;
} else if (!ensure_db_open (dbf)) {
+ gripe_rwopen_failed (dbf);
closedir (dir);
return 0;
}