aboutsummaryrefslogtreecommitdiffstatshomepage
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
commit8400486b39e9f57a03d2efe49cf8eab233476669 (patch)
tree05031258c9f3babdf621263c0a55031f2a2a2c0a /mansearch.c
parent91ed0105333c4ac483f7581f13a317c5560bdf58 (diff)
downloadmandoc-8400486b39e9f57a03d2efe49cf8eab233476669.tar.gz
mandoc-8400486b39e9f57a03d2efe49cf8eab233476669.tar.zst
mandoc-8400486b39e9f57a03d2efe49cf8eab233476669.zip
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.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/mansearch.c b/mansearch.c
index bec483fc..116b64dc 100644
--- a/mansearch.c
+++ b/mansearch.c
@@ -1,4 +1,4 @@
-/* $Id: mansearch.c,v 1.5 2012/06/09 14:11:16 kristaps Exp $ */
+/* $Id: mansearch.c,v 1.6 2013/06/05 02:00:26 schwarze Exp $ */
/*
* Copyright (c) 2012 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -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);