From 86cb14db2b041f6f78b7d5b6afe10d141c0b773d Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 22 Dec 2008 22:42:44 +0100 Subject: Add code to test write_data_iov a bit --- source3/lib/system.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'source3/lib/system.c') diff --git a/source3/lib/system.c b/source3/lib/system.c index d52d12bf72..ed66666ddb 100644 --- a/source3/lib/system.c +++ b/source3/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); -- cgit