Commit b1127a30 by Sven Strickroth

git_repository_hashfile: Only close file handle if we have a valid one

Otherwise this throws an exception on MFC based systems.

Signed-off-by: Sven Strickroth <email@cs-ware.de>
parent 411cb017
...@@ -1384,7 +1384,7 @@ int git_repository_hashfile( ...@@ -1384,7 +1384,7 @@ int git_repository_hashfile(
{ {
int error; int error;
git_vector filters = GIT_VECTOR_INIT; git_vector filters = GIT_VECTOR_INIT;
git_file fd; git_file fd = -1;
git_off_t len; git_off_t len;
git_buf full_path = GIT_BUF_INIT; git_buf full_path = GIT_BUF_INIT;
...@@ -1435,6 +1435,7 @@ int git_repository_hashfile( ...@@ -1435,6 +1435,7 @@ int git_repository_hashfile(
error = git_odb__hashfd_filtered(out, fd, (size_t)len, type, &filters); error = git_odb__hashfd_filtered(out, fd, (size_t)len, type, &filters);
cleanup: cleanup:
if (fd >= 0)
p_close(fd); p_close(fd);
git_filters_free(&filters); git_filters_free(&filters);
git_buf_free(&full_path); git_buf_free(&full_path);
......
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