Add code to test write_data_iov a bit
authorVolker Lendecke <vl@samba.org>
Mon, 22 Dec 2008 21:42:44 +0000 (22:42 +0100)
committerVolker Lendecke <vl@samba.org>
Mon, 29 Dec 2008 12:24:28 +0000 (13:24 +0100)
source3/lib/system.c

index d52d12bf721ab6e933fb7404d0c1b710ee5d425c..ed66666ddb018d2ca84ce3d2f8de84a7f3ca176f 100644 (file)
@@ -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);