aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--miscutils/man.c8
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}