Re: [PATCH 3/3] git --help COMMAND brings up the git-COMMAND man-page., take two
- From
- H. Peter Anvin <hpa@zytor.com>
- Date
- Nov 16, 2005, 03:45 UTC
- Message-ID
- <437AAB48.7090904@zytor.com>
- In-Reply-To
- <20051116002318.A46C55BF97@nox.op5.se>
Andreas Ericsson wrote:
Show 19 quoted lines
>
> +static void show_man_page(char *git_cmd)
> +{
> + char *page;
> +
> + if (!strncmp(git_cmd, "git", 3))
> + page = git_cmd;
> + else {
> + int page_len = strlen(git_cmd) + 4;
> +
> + page = malloc(page_len + 1);
> + strcpy(page, "git-");
> + strcpy(page + 4, git_cmd);
> + page[page_len] = 0;
> + }
> +
> + execlp("man", "man", page, NULL);
> +}
> +The way this made it into the actual tree was to call /usr/bin/man, but still using execlp(). This is clearly bogus. There *ARE* good reasons to use PATH resolutions for this, since man is one of the interactive commands the user may want to wrapper.
So please drop PATH_TO_MAN that made it into the repository and revert to the original patch.
-hpa