summaryrefslogtreecommitdiff
path: root/libdb
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2022-10-02 14:17:20 +0100
committerColin Watson <cjwatson@debian.org>2022-10-02 14:17:20 +0100
commitd1a5cb5c4819580aa59cd5dd7ceefbdd8248c1be (patch)
tree05622801ff9207f6333d87ec9cceb60a61e1b646 /libdb
parente8d93bc31a15ff87b5872cc76ff292206a6eaaa1 (diff)
mandb: Rearrange database path operations
Moving these into "methods" of `struct dbpaths` makes the control flow clearer by avoiding lots of inlined `#ifdef`s. I fixed a possible crash in `mandb -f` in the process, exposed by the clearer control flow. * src/mandb.c (dbpaths_init, dbpaths_copy_to_tmp, dbpaths_remove_tmp): New functions. (finish_up): Rename to ... (dbpaths_rename_from_tmp): ... this. (do_chown): Rename to ... (dbpaths_chown_if_possible): ... this. (cleanup_sigsafe): Rename to ... (dbpaths_unlink_tmp): ... this, and take a `struct dbpaths *` argument rather than `void *`. (cleanup): Rename to ... (dbpaths_free_elements): ... this, and take a `struct dbpaths *` argument rather than `void *`. (mandb, process_manpath): Use new `dbpaths_*` functions. Only call `dbpaths_rename_from_tmp` if `run_mandb` is set (in practice this was always true anyway but this makes it clearer). Only call `dbpaths_chown_if_possible` if `run_mandb` is set and `dbpaths_rename_from_tmp` was called (this may have caused a crash in some edge cases involving `mandb -f`).
Diffstat (limited to 'libdb')
0 files changed, 0 insertions, 0 deletions