summaryrefslogtreecommitdiffstats
path: root/mansearch.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2013-06-05 02:00:26 +0000
committerIngo Schwarze <schwarze@openbsd.org>2013-06-05 02:00:26 +0000
commitb89434f21ae046433285c9cbccd06a7e60481404 (patch)
treef9d6f3fb89af641748aca368db8213fcb4875386 /mansearch.c
parent38f6d7addec36d20d9119077b886c125c21451af (diff)
downloadmandoc-b89434f21ae046433285c9cbccd06a7e60481404.tar.gz
Some places used PATH_MAX from <limits.h>, some MAXPATHLEN from <sys/param.h>.
Consistently use the PATH_MAX since it is specified by POSIX, while MAXPATHLEN is not. In preparation for using this at a few more places.
Diffstat (limited to 'mansearch.c')
-rw-r--r--mansearch.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/mansearch.c b/mansearch.c
index c82dbf97..472e1cb5 100644
--- a/mansearch.c
+++ b/mansearch.c
@@ -18,11 +18,10 @@
#include "config.h"
#endif
-#include <sys/param.h>
-
#include <assert.h>
#include <fcntl.h>
#include <getopt.h>
+#include <limits.h>
#include <stdio.h>
#include <stdint.h>
#include <stddef.h>
@@ -131,7 +130,7 @@ mansearch(const struct mansearch *search,
{
int fd, rc, c;
int64_t id;
- char buf[MAXPATHLEN];
+ char buf[PATH_MAX];
char *sql;
struct expr *e, *ep;
sqlite3 *db;
@@ -168,7 +167,7 @@ mansearch(const struct mansearch *search,
* on our current directory from which to start the chdir().
*/
- if (NULL == getcwd(buf, MAXPATHLEN)) {
+ if (NULL == getcwd(buf, PATH_MAX)) {
perror(NULL);
goto out;
} else if (-1 == (fd = open(buf, O_RDONLY, 0))) {
@@ -266,9 +265,9 @@ mansearch(const struct mansearch *search,
(*res, maxres * sizeof(struct manpage));
}
strlcpy((*res)[cur].file,
- paths->paths[i], MAXPATHLEN);
- strlcat((*res)[cur].file, "/", MAXPATHLEN);
- strlcat((*res)[cur].file, mp->file, MAXPATHLEN);
+ paths->paths[i], PATH_MAX);
+ strlcat((*res)[cur].file, "/", PATH_MAX);
+ strlcat((*res)[cur].file, mp->file, PATH_MAX);
(*res)[cur].desc = mp->desc;
(*res)[cur].form = mp->form;
free(mp->file);