diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2017-12-28 07:28:07 +0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-01-03 10:33:00 -0800 |
commit | 19f8a59e1730d3ee8d7a69a108bd48508c5355b0 (patch) | |
tree | d35afcd4055644da853ffd44c3b256ecee7c7d43 | |
parent | 936d1b989416a95f593bf81ccae8ac62cd83f279 (diff) | |
download | git-nd/fix-dircheck-in-cached-dir.tar.gz |
dir.c: avoid stat() in valid_cached_dir()nd/fix-dircheck-in-cached-dir
stat() may follow a symlink and return stat data of the link's target
instead of the link itself. We are concerned about the link itself.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r-- | dir.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -1739,7 +1739,7 @@ static int valid_cached_dir(struct dir_struct *dir, */ refresh_fsmonitor(istate); if (!(dir->untracked->use_fsmonitor && untracked->valid)) { - if (stat(path->len ? path->buf : ".", &st)) { + if (lstat(path->len ? path->buf : ".", &st)) { invalidate_directory(dir->untracked, untracked); memset(&untracked->stat_data, 0, sizeof(untracked->stat_data)); return 0; |