]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - fd.c
fd: Make write_all() receive the length by value.
[paraslash.git] / fd.c
diff --git a/fd.c b/fd.c
index 2e05313ea26ece1fd65315e80561fdd626f45fe1..429960cc0ab3d822811a1702c56c99a9e4c1ff10 100644 (file)
--- a/fd.c
+++ b/fd.c
  * \param buf The buffer to be sent.
  * \param len The length of \a buf.
  *
- * \return Standard. In any case, the number of bytes that have been written is
- * stored in \a len.
+ * \return Standard.
  */
-int write_all(int fd, const char *buf, size_t *len)
+int write_all(int fd, const char *buf, size_t len)
 {
-       size_t total = *len;
+       size_t total = len;
 
        assert(total);
-       *len = 0;
-       while (*len < total) {
-               int ret = write(fd, buf + *len, total - *len);
+       len = 0;
+       while (len < total) {
+               int ret = write(fd, buf + len, total - len);
                if (ret == -1)
                        return -ERRNO_TO_PARA_ERROR(errno);
-               *len += ret;
+               len += ret;
        }
-       return 1;
+       return len;
 }
 
 /**