I know I'm extremely late to the party, and this patch has already
On Sat, May 11, 2013 at 1:05 AM, Junio C Hamano <gits...@pobox.com> wrote:
> Filipe Cabecinhas <fil...@gmail.com> writes:
>> Due to a bug in the Darwin kernel, write() calls have a maximum size of
>> INT_MAX bytes.
>> This patch introduces a new compat function: clipped_write
>> This function behaves the same as write() but will write, at most, INT_MAX
>> It may be necessary to include this function on Windows, too.
We are already doing something similar for Windows in mingw_write (see
compat/mingw.c), but with a much smaller size.
It feels a bit pointless to duplicate this logic.
> diff --git a/compat/clipped-write.c b/compat/clipped-write.c
> new file mode 100644
> index 0000000..9183698
> --- /dev/null
> +++ b/compat/clipped-write.c
> @@ -0,0 +1,13 @@
> +#include <limits.h>
> +#include <unistd.h>
> + * 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);
If we were to reuse this logic with Windows, we'd need to have some
way of overriding the max-size of the write.
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html