diff options
author | Junio C Hamano <gitster@pobox.com> | 2007-11-18 01:58:16 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2007-11-22 17:05:04 -0800 |
commit | a50f9fc5feb0a8b8afe51e75ae7c7a87446113e3 (patch) | |
tree | 390b297122204d561e35b2620c0e6916c20328ae /dir.c | |
parent | 637efc3456576d548ed5b42e70deffca42e7428e (diff) | |
download | git-a50f9fc5feb0a8b8afe51e75ae7c7a87446113e3.tar.gz |
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>
Diffstat (limited to 'dir.c')
-rw-r--r-- | dir.c | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -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; } /* |