aboutsummaryrefslogtreecommitdiff
path: root/compat/clipped-write.c
blob: b8f98ff77f7547ba99f23995c4fe62c4cbc7584c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
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);
}