summaryrefslogtreecommitdiff
path: root/dir.c
diff options
context:
space:
mode:
authorJonas Fonseca <fonseca@diku.dk>2006-08-28 01:55:46 +0200
committerJunio C Hamano <junkio@cox.net>2006-08-27 20:49:35 -0700
commitc470701a98700533024b1864b789d4fc17e5e823 (patch)
treeacdb395cdfdaf7cda6154addc24c693631239f0c /dir.c
parent5ff9d11409c706e3a9bf55005f6a555d0bf9202e (diff)
downloadgit-c470701a98700533024b1864b789d4fc17e5e823.tar.gz
Use fstat instead of fseek
Signed-off-by: Jonas Fonseca <fonseca@diku.dk> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'dir.c')
-rw-r--r--dir.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/dir.c b/dir.c
index d53d48f70c..5a40d8ff8c 100644
--- a/dir.c
+++ b/dir.c
@@ -112,17 +112,15 @@ static int add_excludes_from_file_1(const char *fname,
int baselen,
struct exclude_list *which)
{
+ struct stat st;
int fd, i;
long size;
char *buf, *entry;
fd = open(fname, O_RDONLY);
- if (fd < 0)
+ if (fd < 0 || fstat(fd, &st) < 0)
goto err;
- size = lseek(fd, 0, SEEK_END);
- if (size < 0)
- goto err;
- lseek(fd, 0, SEEK_SET);
+ size = st.st_size;
if (size == 0) {
close(fd);
return 0;