From 8b19c88b628f12d1f139c582a634a8058b995b61 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Thu, 22 Sep 2022 22:34:14 +0200 Subject: [PATCH 1/1] 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. --- fd.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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. */ -- 2.39.2