Commit a64bf21b by nulltoken

blob: Fix git_blob_create_fromfile()

parent a51201cc
...@@ -119,9 +119,9 @@ int git_blob_create_fromfile(git_oid *oid, git_repository *repo, const char *pat ...@@ -119,9 +119,9 @@ int git_blob_create_fromfile(git_oid *oid, git_repository *repo, const char *pat
ssize_t read_len; ssize_t read_len;
if (!islnk) 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 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 (read_len < 0) {
if (!islnk) if (!islnk)
......
...@@ -97,7 +97,7 @@ int gitfo_read(git_file fd, void *buf, size_t cnt) ...@@ -97,7 +97,7 @@ int gitfo_read(git_file fd, void *buf, size_t cnt)
cnt -= r; cnt -= r;
b += r; b += r;
} }
return GIT_SUCCESS; return (int)(b - (char *)buf);
} }
int gitfo_write(git_file fd, void *buf, size_t cnt) int gitfo_write(git_file fd, void *buf, size_t cnt)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment