summaryrefslogtreecommitdiff
path: root/compat
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-06-02 22:54:54 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-06-02 22:54:54 (GMT)
commit29d5350c0115d8847d010830b0dcca429b038e31 (patch)
tree598980e3e9e7265abb7292849420292e43244ac8 /compat
parent1197c2298bd47c7046b57d92df2fd055051fbe99 (diff)
parent6c642a878688adf46b226903858b53e2d31ac5c3 (diff)
downloadgit-29d5350c0115d8847d010830b0dcca429b038e31.zip
git-29d5350c0115d8847d010830b0dcca429b038e31.tar.gz
git-29d5350c0115d8847d010830b0dcca429b038e31.tar.bz2
Merge branch 'fc/macos-x-clipped-write'
Mac OS X does not like to write(2) more than INT_MAX number of bytes. * fc/macos-x-clipped-write: compate/clipped-write.c: large write(2) fails on Mac OS X/XNU
Diffstat (limited to 'compat')
-rw-r--r--compat/clipped-write.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/compat/clipped-write.c b/compat/clipped-write.c
new file mode 100644
index 0000000..b8f98ff
--- /dev/null
+++ b/compat/clipped-write.c
@@ -0,0 +1,13 @@
+#include "../git-compat-util.h"
+#undef write
+
+/*
+ * Version of write that will write at most INT_MAX bytes.
+ * Workaround a xnu bug on Mac OS X
+ */
+ssize_t clipped_write(int fildes, const void *buf, size_t nbyte)
+{
+ if (nbyte > INT_MAX)
+ nbyte = INT_MAX;
+ return write(fildes, buf, nbyte);
+}