]> git.tuebingen.mpg.de Git - adu.git/blobdiff - fd.c
Merge branch 'refs/heads/t/doc-improvements'
[adu.git] / fd.c
diff --git a/fd.c b/fd.c
index cb6724a2c473827b36d8b3716872ebab6a0d588e..39e98374b3acb9ccc727426bf0b6b06d047b57e7 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
- * 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);
        }
@@ -175,9 +176,10 @@ int adu_opendir(const char *dirname, DIR **dir, int *cwd)
        if (*dir)
                return 1;
        ret = -ERRNO_TO_ERROR(errno);
-/* Ignore return value of fchdir() and close(). We're busted anyway. */
-       if (cwd)
-               fchdir(*cwd);
+       /* Ignore return value of fchdir() and close(). We're busted anyway. */
+       if (cwd) {
+               int __a_unused ret2 = fchdir(*cwd); /* STFU, gcc */
+       }
 close_cwd:
        if (cwd)
                close(*cwd);