summaryrefslogtreecommitdiff
path: root/git-compat-util.h
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-06-03 19:06:41 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-06-03 19:06:41 (GMT)
commit9af098c29b2faa89225556258ae0e3676741c981 (patch)
treeba6752e3109e5206465c08fdf2538deb9ee4704b /git-compat-util.h
parent2cc70cefdd4a249fab895943890d21071e03f8c7 (diff)
parent426ddeead6112955dfb50ccf9bb4af05d1ca9082 (diff)
downloadgit-9af098c29b2faa89225556258ae0e3676741c981.zip
git-9af098c29b2faa89225556258ae0e3676741c981.tar.gz
git-9af098c29b2faa89225556258ae0e3676741c981.tar.bz2
Merge branch 'ym/fix-opportunistic-index-update-race'
Read-only operations such as "git status" that internally refreshes the index write out the refreshed index to the disk to optimize future accesses to the working tree, but this could race with a "read-write" operation that modify the index while it is running. Detect such a race and avoid overwriting the index. Duy raised a good point that we may need to do the same for the normal writeout codepath, not just the "opportunistic" update codepath. While that is true, nobody sane would be running two simultaneous operations that are clearly write-oriented competing with each other against the same index file. So in that sense that can be done as a less urgent follow-up for this topic. * ym/fix-opportunistic-index-update-race: read-cache.c: verify index file before we opportunistically update it wrapper.c: add xpread() similar to xread()
Diffstat (limited to 'git-compat-util.h')
-rw-r--r--git-compat-util.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/git-compat-util.h b/git-compat-util.h
index 7fe1ffda0..76910e6 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -539,6 +539,7 @@ extern void *xcalloc(size_t nmemb, size_t size);
extern void *xmmap(void *start, size_t length, int prot, int flags, int fd, off_t offset);
extern ssize_t xread(int fd, void *buf, size_t len);
extern ssize_t xwrite(int fd, const void *buf, size_t len);
+extern ssize_t xpread(int fd, void *buf, size_t len, off_t offset);
extern int xdup(int fd);
extern FILE *xfdopen(int fd, const char *mode);
extern int xmkstemp(char *template);