diff options
author | Ron Yorston <rmy@pobox.com> | 2019-03-22 16:25:32 +0000 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2019-03-26 17:46:21 +0100 |
commit | 3c6f3336e124be483e4852f022b1d07c1d2f7f2c (patch) | |
tree | 5d7fe8471ca058671bb773359c125277bfa4350d /miscutils/man.c | |
parent | fe78c9a8b727b0145fa93505cca621fe7962b9e9 (diff) | |
download | busybox-w32-3c6f3336e124be483e4852f022b1d07c1d2f7f2c.tar.gz busybox-w32-3c6f3336e124be483e4852f022b1d07c1d2f7f2c.tar.bz2 busybox-w32-3c6f3336e124be483e4852f022b1d07c1d2f7f2c.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.
function old new delta
add_MANPATH 170 183 +13
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/0 up/down: 13/0) Total: 13 bytes
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to '')
-rw-r--r-- | miscutils/man.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/miscutils/man.c b/miscutils/man.c index 01155c8f0..9884325b7 100644 --- a/miscutils/man.c +++ b/miscutils/man.c | |||
@@ -209,8 +209,12 @@ static char **add_MANPATH(char **man_path_list, int *count_mp, char *path) | |||
209 | /* Do we already have path? */ | 209 | /* Do we already have path? */ |
210 | path_element = man_path_list; | 210 | path_element = man_path_list; |
211 | if (path_element) while (*path_element) { | 211 | if (path_element) while (*path_element) { |
212 | if (strcmp(*path_element, path) == 0) | 212 | if (strcmp(*path_element, path) == 0) { |
213 | /* Have path but haven't counted it, must be default */ | ||
214 | if (*count_mp == 0) | ||
215 | break; | ||
213 | goto skip; | 216 | goto skip; |
217 | } | ||
214 | path_element++; | 218 | path_element++; |
215 | } | 219 | } |
216 | man_path_list = xrealloc_vector(man_path_list, 4, *count_mp); | 220 | man_path_list = xrealloc_vector(man_path_list, 4, *count_mp); |