diff options
| author | Denys Vlasenko <vda.linux@googlemail.com> | 2014-11-30 19:39:58 +0100 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2014-11-30 19:39:58 +0100 |
| commit | 476654cdbeb2923fc5d2485701587b42579e1635 (patch) | |
| tree | 529d6eba749e26fe88d944f50399b499402bab6d /miscutils | |
| parent | 8d75d794ea505003fddea8e757d43976db8d6861 (diff) | |
| download | busybox-w32-476654cdbeb2923fc5d2485701587b42579e1635.tar.gz busybox-w32-476654cdbeb2923fc5d2485701587b42579e1635.tar.bz2 busybox-w32-476654cdbeb2923fc5d2485701587b42579e1635.zip | |
man: do not mangle $MANPATH in memory
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'miscutils')
| -rw-r--r-- | miscutils/man.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/miscutils/man.c b/miscutils/man.c index ccb57a93f..c39870e67 100644 --- a/miscutils/man.c +++ b/miscutils/man.c | |||
| @@ -155,9 +155,9 @@ static char **add_MANPATH(char **man_path_list, int *count_mp, char *path) | |||
| 155 | 155 | ||
| 156 | next_path = strchr(path, ':'); | 156 | next_path = strchr(path, ':'); |
| 157 | if (next_path) { | 157 | if (next_path) { |
| 158 | *next_path = '\0'; | 158 | if (next_path == path) /* "::"? */ |
| 159 | if (next_path++ == path) /* "::"? */ | ||
| 160 | goto next; | 159 | goto next; |
| 160 | *next_path = '\0'; | ||
| 161 | } | 161 | } |
| 162 | /* Do we already have path? */ | 162 | /* Do we already have path? */ |
| 163 | path_element = man_path_list; | 163 | path_element = man_path_list; |
| @@ -174,8 +174,10 @@ static char **add_MANPATH(char **man_path_list, int *count_mp, char *path) | |||
| 174 | skip: | 174 | skip: |
| 175 | if (!next_path) | 175 | if (!next_path) |
| 176 | break; | 176 | break; |
| 177 | /* "path" may be a result of getenv(), be nice and don't mangle it */ | ||
| 178 | *next_path = ':'; | ||
| 177 | next: | 179 | next: |
| 178 | path = next_path; | 180 | path = next_path + 1; |
| 179 | } | 181 | } |
| 180 | return man_path_list; | 182 | return man_path_list; |
| 181 | } | 183 | } |
