summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-08-16 18:41:27 (GMT)
committerJunio C Hamano <gitster@pobox.com>2011-08-16 18:41:27 (GMT)
commitcd145e72f3c1539e5817cfcf03a5f9fed3685f48 (patch)
tree79197d7ee861024607df754d62910548e61ca025
parent8516c1c231272e3c8fb42ba34306c776e6a90409 (diff)
parent7d092adc8f4f54d18f5737c155d5b21e45e81a74 (diff)
downloadgit-cd145e72f3c1539e5817cfcf03a5f9fed3685f48.zip
git-cd145e72f3c1539e5817cfcf03a5f9fed3685f48.tar.gz
git-cd145e72f3c1539e5817cfcf03a5f9fed3685f48.tar.bz2
Merge branch 'js/maint-add-path-stat-pwd' into maint
* js/maint-add-path-stat-pwd: get_pwd_cwd(): Do not trust st_dev/st_ino blindly
-rw-r--r--abspath.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/abspath.c b/abspath.c
index 3005aed..f9494c4 100644
--- a/abspath.c
+++ b/abspath.c
@@ -102,7 +102,8 @@ static const char *get_pwd_cwd(void)
pwd = getenv("PWD");
if (pwd && strcmp(pwd, cwd)) {
stat(cwd, &cwd_stat);
- if (!stat(pwd, &pwd_stat) &&
+ if ((cwd_stat.st_dev || cwd_stat.st_ino) &&
+ !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);