summaryrefslogtreecommitdiff
path: root/dir.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2007-11-18 09:58:16 (GMT)
committerJunio C Hamano <gitster@pobox.com>2007-11-23 01:05:04 (GMT)
commita50f9fc5feb0a8b8afe51e75ae7c7a87446113e3 (patch)
tree390b297122204d561e35b2620c0e6916c20328ae /dir.c
parent637efc3456576d548ed5b42e70deffca42e7428e (diff)
downloadgit-a50f9fc5feb0a8b8afe51e75ae7c7a87446113e3.zip
git-a50f9fc5feb0a8b8afe51e75ae7c7a87446113e3.tar.gz
git-a50f9fc5feb0a8b8afe51e75ae7c7a87446113e3.tar.bz2
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.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/dir.c b/dir.c
index 225fdfb..11a4cf3 100644
--- a/dir.c
+++ b/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;
}
/*