summaryrefslogtreecommitdiffstats
path: root/mandocdb.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2011-11-29 00:34:50 +0000
committerIngo Schwarze <schwarze@openbsd.org>2011-11-29 00:34:50 +0000
commit254ae39f2f6d2771a85ade494541410226ac8c03 (patch)
treeb08584deeea7c58e01fc8e7ddb0ff5e7a25d81ee /mandocdb.c
parent0dad748a006c8d6b6afd406bab046673ae02cb50 (diff)
downloadmandoc-254ae39f2f6d2771a85ade494541410226ac8c03.tar.gz
chdir(2) to the right man page tree before parsing manuals;
ok kristaps@
Diffstat (limited to 'mandocdb.c')
-rw-r--r--mandocdb.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/mandocdb.c b/mandocdb.c
index fed68258..4959350e 100644
--- a/mandocdb.c
+++ b/mandocdb.c
@@ -31,6 +31,7 @@
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
#ifdef __linux__
# include <db_185.h>
@@ -383,10 +384,18 @@ main(int argc, char *argv[])
index_prune(of, db, fbuf, idx, ibuf,
&maxrec, &recs, &recsz);
- if (OP_UPDATE == op)
+ /*
+ * Go to the root of the respective manual tree
+ * such that .so links work. In case of failure,
+ * just prod on, even though .so links won't work.
+ */
+
+ if (OP_UPDATE == op) {
+ chdir(dir);
index_merge(of, mp, &dbuf, &buf, hash,
db, fbuf, idx, ibuf,
maxrec, recs, reccur);
+ }
goto out;
}
@@ -455,6 +464,13 @@ main(int argc, char *argv[])
of = of->first;
+ /*
+ * Go to the root of the respective manual tree
+ * such that .so links work. In case of failure,
+ * just prod on, even though .so links won't work.
+ */
+
+ chdir(dirs.paths[i]);
index_merge(of, mp, &dbuf, &buf, hash, db, fbuf,
idx, ibuf, maxrec, recs, reccur);
}