From f1fcb808a56943b7332f888f5cc9cc357c5be66a Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 22 Dec 2008 22:42:44 +0100 Subject: [PATCH] Add code to test write_data_iov a bit (cherry picked from commit 8c7552790934397c1bbb7e93eb64716a5fed31fa) --- source/lib/system.c | 11 +++++++++++ 1 file changed, 11 insertions(+) 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); -- 2.11.4.GIT