man: do not mangle $MANPATH in memory
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
8d75d794ea
commit
476654cdbe
@ -155,9 +155,9 @@ static char **add_MANPATH(char **man_path_list, int *count_mp, char *path)
|
|||||||
|
|
||||||
next_path = strchr(path, ':');
|
next_path = strchr(path, ':');
|
||||||
if (next_path) {
|
if (next_path) {
|
||||||
*next_path = '\0';
|
if (next_path == path) /* "::"? */
|
||||||
if (next_path++ == path) /* "::"? */
|
|
||||||
goto next;
|
goto next;
|
||||||
|
*next_path = '\0';
|
||||||
}
|
}
|
||||||
/* Do we already have path? */
|
/* Do we already have path? */
|
||||||
path_element = man_path_list;
|
path_element = man_path_list;
|
||||||
@ -174,8 +174,10 @@ static char **add_MANPATH(char **man_path_list, int *count_mp, char *path)
|
|||||||
skip:
|
skip:
|
||||||
if (!next_path)
|
if (!next_path)
|
||||||
break;
|
break;
|
||||||
|
/* "path" may be a result of getenv(), be nice and don't mangle it */
|
||||||
|
*next_path = ':';
|
||||||
next:
|
next:
|
||||||
path = next_path;
|
path = next_path + 1;
|
||||||
}
|
}
|
||||||
return man_path_list;
|
return man_path_list;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user