diff options
author | Junio C Hamano <gitster@pobox.com> | 2013-06-02 15:54:54 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-06-02 15:54:54 -0700 |
commit | 29d5350c0115d8847d010830b0dcca429b038e31 (patch) | |
tree | 598980e3e9e7265abb7292849420292e43244ac8 /compat | |
parent | 1197c2298bd47c7046b57d92df2fd055051fbe99 (diff) | |
parent | 6c642a878688adf46b226903858b53e2d31ac5c3 (diff) | |
download | git-29d5350c0115d8847d010830b0dcca429b038e31.tar.gz |
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.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); +} |