зеркало из https://github.com/microsoft/git.git
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: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
637efc3456
Коммит
a50f9fc5fe
7
dir.c
7
dir.c
|
@ -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;
|
||||
struct stat sb;
|
||||
return lstat(f, &sb) == 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Загрузка…
Ссылка в новой задаче