summaryrefslogtreecommitdiff
path: root/abspath.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-07-22 14:43:36 -0700
committerJunio C Hamano <gitster@pobox.com>2011-07-22 14:43:36 -0700
commitb07522797915c1f907d7b7547510e659ddf01df5 (patch)
tree29ee71e26c22f456f7020ab067bf3003948c2c7e /abspath.c
parentc8409e716a8a117ee37fb0c4b8ecbfcc4bac3fe9 (diff)
parent7d092adc8f4f54d18f5737c155d5b21e45e81a74 (diff)
downloadgit-b07522797915c1f907d7b7547510e659ddf01df5.tar.gz
Merge branch 'js/maint-add-path-stat-pwd'
* js/maint-add-path-stat-pwd: get_pwd_cwd(): Do not trust st_dev/st_ino blindly
Diffstat (limited to 'abspath.c')
-rw-r--r--abspath.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/abspath.c b/abspath.c
index 01858eb7bc..37287f86c1 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);