* mdocml: In update mode, when opening the database fails, probably
@ 2014-04-18 21:55 schwarze
0 siblings, 0 replies; only message in thread
From: schwarze @ 2014-04-18 21:55 UTC (permalink / raw)
To: source
Log Message:
-----------
In update mode, when opening the database fails, probably because it is
missing or corrupt, just rebuild it from scratch. This also helps when
installing the very first port on a freshly installed machine
and is similar to what espie@'s classical makewhatis(8) did.
Issue reported by naddy@ via kili@.
Modified Files:
--------------
mdocml:
mandocdb.c
Revision Data
-------------
Index: mandocdb.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mandocdb.c,v
retrieving revision 1.137
retrieving revision 1.138
diff -Lmandocdb.c -Lmandocdb.c -u -p -r1.137 -r1.138
--- mandocdb.c
+++ mandocdb.c
@@ -442,15 +442,25 @@ main(int argc, char *argv[])
*/
if (0 == set_basedir(path_arg))
goto out;
- for (i = 0; i < argc; i++)
- filescan(argv[i]);
- if (0 == dbopen(1))
- goto out;
- if (OP_TEST != op)
- dbprune();
+ if (dbopen(1)) {
+ for (i = 0; i < argc; i++)
+ filescan(argv[i]);
+ if (OP_TEST != op)
+ dbprune();
+ } else {
+ /*
+ * Database missing or corrupt.
+ * Recreate from scratch.
+ */
+ op = OP_DEFAULT;
+ if (0 == treescan())
+ goto out;
+ if (0 == dbopen(0))
+ goto out;
+ }
if (OP_DELETE != op)
mpages_merge(mc, mp);
- dbclose(1);
+ dbclose(OP_DEFAULT == op ? 0 : 1);
} else {
/*
* If we have arguments, use them as our manpaths.
--
To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-04-18 21:55 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-18 21:55 mdocml: In update mode, when opening the database fails, probably schwarze
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).