Re: [PATCH] Allow add_path() to add non-existent directories to the path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Johannes Sixt schrieb:
> +static const char *get_pwd_cwd(void)
> +{
> +	static char cwd[PATH_MAX + 1];
> +	char *pwd;
> +	struct stat cwd_stat, pwd_stat;
> +	if (getcwd(cwd, PATH_MAX) == NULL)
> +		return NULL;
> +	pwd = getenv("PWD");
> +	if (pwd && strcmp(pwd, cwd)) {
> +		stat(cwd, &cwd_stat);
> +		if (!stat(pwd, &pwd_stat) &&
> +		    pwd_stat.st_dev == cwd_stat.st_dev &&
> +		    pwd_stat.st_ino == cwd_stat.st_ino) {
> +			strlcpy(cwd, pwd, PATH_MAX);

git-bash users on Windows, please test this patch. The problem is that
with our custom stat implementation st_dev and st_ino are not reliable. It
 works in my setup because $PWD is not set and this branch is never
entered, but with bash it makes a difference.

-- Hannes

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux