Skip to content

Commit

Permalink
Merge branch 'js/maint-add-path-stat-pwd' into maint
Browse files Browse the repository at this point in the history
* js/maint-add-path-stat-pwd:
  get_pwd_cwd(): Do not trust st_dev/st_ino blindly
  • Loading branch information
Junio C Hamano committed Aug 16, 2011
2 parents 8516c1c + 7d092ad commit cd145e7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion abspath.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit cd145e7

Please sign in to comment.