aboutsummaryrefslogtreecommitdiffstatshomepage
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
commitbbd94399a66a2b5f40e7187fbb8dea777dc70cf6 (patch)
tree62f4610523bf45f0805235b56d36fdc7e3af2447
parent48b8e571a4b5e817471a354007d34aa891e9c3a1 (diff)
downloadmandoc-bbd94399a66a2b5f40e7187fbb8dea777dc70cf6.tar.gz
mandoc-bbd94399a66a2b5f40e7187fbb8dea777dc70cf6.tar.zst
mandoc-bbd94399a66a2b5f40e7187fbb8dea777dc70cf6.zip
chdir(2) to the right man page tree before parsing manuals;
ok kristaps@
-rw-r--r--mandocdb.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/mandocdb.c b/mandocdb.c
index 9d0417a0..c1daa2d8 100644
--- a/mandocdb.c
+++ b/mandocdb.c
@@ -1,4 +1,4 @@
-/* $Id: mandocdb.c,v 1.16 2011/11/27 23:27:31 schwarze Exp $ */
+/* $Id: mandocdb.c,v 1.17 2011/11/29 00:34:50 schwarze Exp $ */
/*
* Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org>
@@ -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);
}