From 8532469a26969f2945b06cd7b6ee7fadf2cf6830 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sat, 3 Jan 2015 22:06:36 +0000 Subject: [PATCH] fd.c: EAGAIN can not happen in __write(). The only caller does not specify O_NONBLOCK, so the check for EAGAIN is unnecessary. --- fd.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fd.c b/fd.c index cb6724a..902e8f1 100644 --- a/fd.c +++ b/fd.c @@ -24,7 +24,8 @@ * \param size The length of \a buf in bytes. * * This function writes out the given buffer and retries if an interrupt - * occurred during the write. + * occurred during the write. The file descriptor is assumed to be in blocking + * mode (i.e., EAGAIN is treated as an error). * * \return Standard. * @@ -36,7 +37,7 @@ static ssize_t __write(int fd, const void *buf, size_t size) for (;;) { ret = write(fd, buf, size); - if ((ret < 0) && (errno == EAGAIN || errno == EINTR)) + if (ret < 0 && errno == EINTR) continue; return ret >= 0? ret : -ERRNO_TO_ERROR(errno); } -- 2.39.2