Browse Source
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/XNUmaint

4 changed files with 27 additions and 0 deletions
@ -0,0 +1,13 @@
@@ -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); |
||||
} |
Loading…
Reference in new issue