From 8400486b39e9f57a03d2efe49cf8eab233476669 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Wed, 5 Jun 2013 02:00:26 +0000 Subject: Some places used PATH_MAX from , some MAXPATHLEN from . 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. --- mansearch.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'mansearch.c') 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 * @@ -18,11 +18,10 @@ #include "config.h" #endif -#include - #include #include #include +#include #include #include #include @@ -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); -- cgit v1.2.3-56-ge451