]> git.tuebingen.mpg.de Git - adu.git/commitdiff
fd.c: EAGAIN can not happen in __write().
authorAndre Noll <maan@tuebingen.mpg.de>
Sat, 3 Jan 2015 22:06:36 +0000 (22:06 +0000)
committerAndre Noll <maan@tuebingen.mpg.de>
Sun, 15 Feb 2015 15:53:31 +0000 (16:53 +0100)
The only caller does not specify O_NONBLOCK, so the check for EAGAIN
is unnecessary.

fd.c

diff --git a/fd.c b/fd.c
index cb6724a2c473827b36d8b3716872ebab6a0d588e..902e8f1898d29c7ace5a481c4f731ce7134f4433 100644 (file)
--- 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
  * \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.
  *
  *
  * \return Standard.
  *
@@ -36,7 +37,7 @@ static ssize_t __write(int fd, const void *buf, size_t size)
 
        for (;;) {
                ret = write(fd, buf, 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);
        }
                        continue;
                return ret >= 0? ret : -ERRNO_TO_ERROR(errno);
        }