From: Timo Sirainen Date: Mon, 21 May 2018 15:35:23 +0000 (+0300) Subject: lib: o_stream_send*() - Add ATTR_WARN_UNUSED_RESULT X-Git-Tag: 2.3.9~1601 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6624d420d5cbc79fd260899ab994e5c33622c266;p=thirdparty%2Fdovecot%2Fcore.git lib: o_stream_send*() - Add ATTR_WARN_UNUSED_RESULT Callers either need to check the return value or use o_stream_nsend*(). --- diff --git a/src/lib/ostream.h b/src/lib/ostream.h index 9685e1bcac..718e111c99 100644 --- a/src/lib/ostream.h +++ b/src/lib/ostream.h @@ -166,10 +166,12 @@ size_t o_stream_get_buffer_avail_size(const struct ostream *stream) ATTR_PURE; files. Returns 1 if successful, -1 if error. */ int o_stream_seek(struct ostream *stream, uoff_t offset); /* Returns number of bytes sent, -1 = error */ -ssize_t o_stream_send(struct ostream *stream, const void *data, size_t size); +ssize_t o_stream_send(struct ostream *stream, const void *data, size_t size) + ATTR_WARN_UNUSED_RESULT; ssize_t o_stream_sendv(struct ostream *stream, const struct const_iovec *iov, - unsigned int iov_count); -ssize_t o_stream_send_str(struct ostream *stream, const char *str); + unsigned int iov_count) ATTR_WARN_UNUSED_RESULT; +ssize_t o_stream_send_str(struct ostream *stream, const char *str) + ATTR_WARN_UNUSED_RESULT; /* Send with delayed error handling. o_stream_flush() or o_stream_ignore_last_errors() must be called after these functions before the stream is destroyed. If any of the data can't be sent due to stream's @@ -211,7 +213,7 @@ void o_stream_set_no_error_handling(struct ostream *stream, bool set); It's also possible to use this function to copy data within same file descriptor, even if the source and destination overlaps. If the file must be grown, you have to do it manually before calling this function. */ -enum ostream_send_istream_result +enum ostream_send_istream_result ATTR_WARN_UNUSED_RESULT o_stream_send_istream(struct ostream *outstream, struct istream *instream); /* Same as o_stream_send_istream(), but assume that reads and writes will succeed. If not, o_stream_flush() will fail with the correct error