blob: Fix git_blob_create_fromfile()

This commit is contained in:
nulltoken 2011-06-15 16:05:33 +02:00
parent a51201cc73
commit a64bf21bbb
2 changed files with 3 additions and 3 deletions

View File

@ -119,9 +119,9 @@ int git_blob_create_fromfile(git_oid *oid, git_repository *repo, const char *pat
ssize_t read_len;
if (!islnk)
read_len = gitfo_read(fd, buffer, sizeof(buffer));
read_len = gitfo_read(fd, buffer, (size_t)(size < sizeof(buffer) ? size : sizeof(buffer)));
else
read_len = gitfo_readlink(full_path, buffer, sizeof(buffer));
read_len = gitfo_readlink(full_path, buffer, (size_t)size);
if (read_len < 0) {
if (!islnk)

View File

@ -97,7 +97,7 @@ int gitfo_read(git_file fd, void *buf, size_t cnt)
cnt -= r;
b += r;
}
return GIT_SUCCESS;
return (int)(b - (char *)buf);
}
int gitfo_write(git_file fd, void *buf, size_t cnt)