提交 a50f9fc5 编写于 作者: J Junio C Hamano

file_exists(): dangling symlinks do exist

This function is used to see if a path given by the user does exist
on the filesystem.  A symbolic link that does not point anywhere does
exist but running stat() on it would yield an error, and it incorrectly
said it does not exist.
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 637efc34
......@@ -690,11 +690,10 @@ int read_directory(struct dir_struct *dir, const char *path, const char *base, i
return dir->nr;
}
int
file_exists(const char *f)
int file_exists(const char *f)
{
struct stat sb;
return stat(f, &sb) == 0;
return lstat(f, &sb) == 0;
}
/*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册