]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: istream-seekable - Assert that write() won't return 0
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 3 Jun 2024 20:23:40 +0000 (23:23 +0300)
committerMarkus Valentin <markus.valentin@open-xchange.com>
Tue, 3 Dec 2024 13:36:36 +0000 (14:36 +0100)
src/lib/istream-seekable.c

index 9c7d294052726848b578863855c5a59df431f987..b753c9199125c4acbdf3c4fb254bf3bdd7ded91a 100644 (file)
@@ -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);
                        }