diff options
author | Junio C Hamano <gitster@pobox.com> | 2013-06-30 15:33:40 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-06-30 15:33:40 -0700 |
commit | c6c4250eb605a502e1b5128d224561cf71272798 (patch) | |
tree | e12bdffbd7c6e7aea2ed75fcb610a836c0aef07a /compat | |
parent | 91863750cd09c3da93368d8fc6d3caeaabf1d66a (diff) | |
parent | 6c642a878688adf46b226903858b53e2d31ac5c3 (diff) | |
download | git-c6c4250eb605a502e1b5128d224561cf71272798.tar.gz |
Merge branch 'fc/macos-x-clipped-write' into maint
Mac OS X does not like to write(2) more than INT_MAX number of
bytes; work it around by chopping write(2) into smaller pieces.
* 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.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/compat/clipped-write.c b/compat/clipped-write.c new file mode 100644 index 0000000000..b8f98ff77f --- /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); +} |