From: Junio C Hamano Date: Fri, 22 Jul 2011 21:43:36 +0000 (-0700) Subject: Merge branch 'js/maint-add-path-stat-pwd' X-Git-Tag: v1.7.7-rc0~76 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/b07522797915c1f907d7b7547510e659ddf01df5?hp=c8409e716a8a117ee37fb0c4b8ecbfcc4bac3fe9 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 --- 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);