From Bugzilla Helper: User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20050920 Firefox/1.0.7 Description of problem: The readv(2) man page states this about error values: EINVAL The sum of the iov_len values overflows an ssize_t value. Or, the vector count count is zero or greater than IOV_MAX. However a test program shows passing an iovec of 0 will return 0 for both readv() and writev(). Version-Release number of selected component (if applicable): kernel-2.6.14-1.1637_FC4 How reproducible: Always Steps to Reproduce: 1. Compile this program as iov.c: #include <sys/uio.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <stdlib.h> #include <stdio.h> main() { int fd, ret; struct iovec iov; char buf[128]; if ((fd = open("iov.c", O_RDWR)) < 0) { perror("failed to open iov.c"); exit(1); } iov.iov_base = buf; iov.iov_len = 128; if ((ret = readv(fd, &iov, 0)) < 0) perror("readv"); else printf("readv returned %d\n", ret); if ((ret = writev(fd, &iov, 0)) < 0) perror("writev"); else printf("writev returned %d\n", ret); close(fd); exit(0); } 2. Run a.out Actual Results: readv returned 0 writev returned 0 Expected Results: Both calls should have returned -1 with errno set to EINVAL. Additional info: This may be either a man page error or a bug in the kernel; a decision needs to be made by the kernel developers as to whether the call or the man page is in error.
This bug is fixed in the last version of man-pages (man-pages-2.16-2) ( EINVAL The sum of the iov_len values overflows an ssize_t value. Or, the vector count count is less than zero or greater than the permitted maximum.)