Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
file_exists(): dangling symlinks do exist
author
Junio C Hamano
<gitster@pobox.com>
Sun, 18 Nov 2007 09:58:16 +0000
(
01:58
-0800)
committer
Junio C Hamano
<gitster@pobox.com>
Fri, 23 Nov 2007 01:05:04 +0000
(17:05 -0800)
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>
dir.c
patch
|
blob
|
history
raw
|
patch
| inline |
side by side
(parent:
637efc3
)
diff --git
a/dir.c
b/dir.c
index 225fdfb52c432b7af1af1cdf9aa9a31f8022e3ec..11a4cf3e16f840ca826b927ce504535eec8c71db 100644
(file)
--- 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 l
stat(f, &sb) == 0;
}
/*