From: Andre Noll Date: Thu, 22 Sep 2022 20:34:14 +0000 (+0200) Subject: fd: Improve documentation of write_all(). X-Git-Tag: v0.7.3~13^2~8 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=8b19c88b628f12d1f139c582a634a8058b995b61;p=paraslash.git fd: Improve documentation of write_all(). The name of this public function is a bit of a misnomer, so be at least clear in the one-line description what the function does in the EAGAIN case or if a short write occurs. --- diff --git a/fd.c b/fd.c index 5d23babf..180032da 100644 --- a/fd.c +++ b/fd.c @@ -126,14 +126,15 @@ int xwrite(int fd, const char *buf, size_t len) } /** - * Write all data to a file descriptor. + * Write to a file descriptor, fail on short writes. * * \param fd The file descriptor. - * \param buf The buffer to be sent. - * \param len The length of \a buf. + * \param buf The buffer to be written. + * \param len The length of the buffer. * - * This is like \ref xwrite() but returns \p -E_SHORT_WRITE if not - * all data could be written. + * For blocking file descriptors this function behaves identical to \ref + * xwrite(). For non-blocking file descriptors it returns -E_SHORT_WRITE + * (rather than a value less than len) if not all data could be written. * * \return Number of bytes written on success, negative error code else. */