From 033731a5b54d95ff950dd3963320407e1fae459d Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Tue, 27 Mar 2018 00:39:48 +0200 Subject: [PATCH] fd: Let readv_nonblock() recover from EINTR. No need to fail the operation if the read was interrupted by a signal. The patch also fixes some minor issues in the documentation: a typo ("The" was incorrectly capitalized) and a missing \ref for xwrite(). We use the opportunity to get rid of the \a and \p font annotations. This improves the readability of the source code, which is more imporatant than nice looking web pages. However, we only touch those parts of the documentation which are modified anyway. --- fd.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/fd.c b/fd.c index 86a1f105..0347fd83 100644 --- a/fd.c +++ b/fd.c @@ -179,15 +179,15 @@ __printf_2_3 int write_va_buffer(int fd, const char *fmt, ...) * \param rfds An optional fd set pointer. * \param num_bytes Result pointer. Contains the number of bytes read from \a fd. * - * If \a rfds is not \p NULL and the (non-blocking) file descriptor \a fd is - * not set in \a rfds, this function returns early without doing anything. - * Otherwise The function tries to read up to \a sz bytes from \a fd, where \a - * sz is the sum of the lengths of all vectors in \a iov. As for xwrite(), - * \p EAGAIN is not considered an error condition. However, \p EOF is. + * If rfds is not NULL and the (non-blocking) file descriptor fd is not set in + * rfds, this function returns early without doing anything. Otherwise it tries + * to read up to sz bytes from fd, where sz is the sum of the lengths of all + * vectors in iov. Like \ref xwrite(), EAGAIN and EINTR are not considered + * error conditions. However, EOF is. * * \return Zero or a negative error code. If the underlying call to readv(2) * returned zero (indicating an end of file condition) or failed for some - * reason other than \p EAGAIN, a negative error code is returned. + * reason other than EAGAIN or EINTR, a negative error code is returned. * * In any case, \a num_bytes contains the number of bytes that have been * successfully read from \a fd (zero if the first readv() call failed with @@ -226,7 +226,7 @@ int readv_nonblock(int fd, struct iovec *iov, int iovcnt, fd_set *rfds, if (ret == 0) return -E_EOF; if (ret < 0) { - if (errno == EAGAIN) + if (errno == EAGAIN || errno == EINTR) return 0; return -ERRNO_TO_PARA_ERROR(errno); } -- 2.39.2