From: Timo Sirainen Date: Mon, 3 Jun 2024 20:23:40 +0000 (+0300) Subject: lib: istream-seekable - Assert that write() won't return 0 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6afc5b06a543c936aa428d758d7f8bad3f13fb66;p=thirdparty%2Fdovecot%2Fcore.git lib: istream-seekable - Assert that write() won't return 0 --- diff --git a/src/lib/istream-seekable.c b/src/lib/istream-seekable.c index 9c7d294052..b753c91991 100644 --- a/src/lib/istream-seekable.c +++ b/src/lib/istream-seekable.c @@ -306,9 +306,11 @@ static ssize_t i_stream_seekable_read(struct istream_private *stream) /* save to our file */ data = i_stream_get_data(sstream->cur_input, &size); + i_assert(size > 0); ret = write(sstream->fd, data, size); - if (ret <= 0) { - if (ret < 0 && !ENOSPACE(errno)) { + i_assert(ret != 0); + if (ret < 0) { + if (!ENOSPACE(errno)) { i_error("istream-seekable: write_full(%s) failed: %m", sstream->temp_path); }