diff options
author | Vicent Marti <vicent@github.com> | 2014-04-18 12:33:19 +0200 |
---|---|---|
committer | Vicent Marti <vicent@github.com> | 2014-04-18 12:33:19 +0200 |
commit | 28fd7206b1359b6564bad3c66382b47a8f2e3eb1 (patch) | |
tree | e0d9204bdfea2a948d94b2b14d382a697b00b6db /src/fileops.c | |
parent | 2bed3553f4595a42d9a6884edc66b991e21f881e (diff) | |
parent | 8303827226db114a1157e6173e731f316c217851 (diff) | |
download | libgit2-28fd7206b1359b6564bad3c66382b47a8f2e3eb1.tar.gz |
Merge pull request #2108 from libgit2/rb/threadsafe-index-iterator
Make index iterator thread safe
Diffstat (limited to 'src/fileops.c')
-rw-r--r-- | src/fileops.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/fileops.c b/src/fileops.c index 5709499b0..13b8f6a39 100644 --- a/src/fileops.c +++ b/src/fileops.c @@ -132,6 +132,7 @@ int git_futils_readbuffer_fd(git_buf *buf, git_file fd, size_t len) if (read_size != (ssize_t)len) { giterr_set(GITERR_OS, "Failed to read descriptor"); + git_buf_free(buf); return -1; } @@ -804,10 +805,8 @@ int git_futils_filestamp_check( if (stamp == NULL) return 1; - if (p_stat(path, &st) < 0) { - giterr_set(GITERR_OS, "Could not stat '%s'", path); + if (p_stat(path, &st) < 0) return GIT_ENOTFOUND; - } if (stamp->mtime == (git_time_t)st.st_mtime && stamp->size == (git_off_t)st.st_size && @@ -831,3 +830,16 @@ void git_futils_filestamp_set( else memset(target, 0, sizeof(*target)); } + + +void git_futils_filestamp_set_from_stat( + git_futils_filestamp *stamp, struct stat *st) +{ + if (st) { + stamp->mtime = (git_time_t)st->st_mtime; + stamp->size = (git_off_t)st->st_size; + stamp->ino = (unsigned int)st->st_ino; + } else { + memset(stamp, 0, sizeof(*stamp)); + } +} |