From: Volker Lendecke Date: Mon, 22 Dec 2008 21:42:44 +0000 (+0100) Subject: Add code to test write_data_iov a bit X-Git-Tag: samba-3.3.0~124 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f1fcb808a56943b7332f888f5cc9cc357c5be66a;p=thirdparty%2Fsamba.git Add code to test write_data_iov a bit (cherry picked from commit 8c7552790934397c1bbb7e93eb64716a5fed31fa) --- diff --git a/source/lib/system.c b/source/lib/system.c index 5b06d3c7600..48ecf903d94 100644 --- a/source/lib/system.c +++ b/source/lib/system.c @@ -149,6 +149,17 @@ ssize_t sys_writev(int fd, const struct iovec *iov, int iovcnt) { ssize_t ret; +#if 0 + /* Try to confuse write_data_iov a bit */ + if ((random() % 5) == 0) { + return sys_write(fd, iov[0].iov_base, iov[0].iov_len); + } + if (iov[0].iov_len > 1) { + return sys_write(fd, iov[0].iov_base, + (random() % (iov[0].iov_len-1)) + 1); + } +#endif + do { ret = writev(fd, iov, iovcnt); } while (ret == -1 && errno == EINTR);