aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2019-03-28 08:33:21 +0000
committerRon Yorston <rmy@pobox.com>2019-03-28 08:33:21 +0000
commit7018ba917db63c493918af0a5bf2977480d52bc7 (patch)
tree3327665c55c3c3c1c723afb465eca3ec13140bdf
parent578e943afcd9c818f969502a94375b1a70548bf9 (diff)
downloadbusybox-w32-7018ba917db63c493918af0a5bf2977480d52bc7.tar.gz
busybox-w32-7018ba917db63c493918af0a5bf2977480d52bc7.tar.bz2
busybox-w32-7018ba917db63c493918af0a5bf2977480d52bc7.zip
man: don't skip default path which appears in config file
If the MANPATH environment variable isn't set a provisional default path of /usr/man is placed in man_path_list. This is only used if a configuration file doesn't contain an alternative path. If a configuration file lists the default path first: MANPATH /usr/man:/usr/share/man add_MANPATH() sees that the default entry is already present and skips it. As a result man_path_list only contains the second and subsequent components of the configured MANPATH. In such cases the path should not be skipped.
-rw-r--r--miscutils/man.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/miscutils/man.c b/miscutils/man.c
index fd5d90c1a..b2d42b043 100644
--- a/miscutils/man.c
+++ b/miscutils/man.c
@@ -208,8 +208,12 @@ static char **add_MANPATH(char **man_path_list, int *count_mp, char *path)
208 /* Do we already have path? */ 208 /* Do we already have path? */
209 path_element = man_path_list; 209 path_element = man_path_list;
210 if (path_element) while (*path_element) { 210 if (path_element) while (*path_element) {
211 if (strcmp(*path_element, path) == 0) 211 if (strcmp(*path_element, path) == 0) {
212 /* Have path but haven't counted it, must be default */
213 if (*count_mp == 0)
214 break;
212 goto skip; 215 goto skip;
216 }
213 path_element++; 217 path_element++;
214 } 218 }
215 man_path_list = xrealloc_vector(man_path_list, 4, *count_mp); 219 man_path_list = xrealloc_vector(man_path_list, 4, *count_mp);