]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-fs: fs_write() didn't update stats.write_count correctly.
authorTimo Sirainen <tss@iki.fi>
Sun, 16 Aug 2015 11:07:21 +0000 (13:07 +0200)
committerTimo Sirainen <tss@iki.fi>
Sun, 16 Aug 2015 11:07:21 +0000 (13:07 +0200)
If backend implemented asynchronous write(), the write_count was updated multiple
times. If backend didn't implement write(), then it was counted twice.

src/lib-fs/fs-api.c

index f1b6965afa01601c8eee60dd8dfac370e0cfb730..1e8c75856e49b0b186422b1d99c4d875580344fc 100644 (file)
@@ -530,11 +530,12 @@ int fs_write(struct fs_file *file, const void *data, size_t size)
 {
        int ret;
 
-       file->fs->stats.write_count++;
        if (file->fs->v.write != NULL) {
                T_BEGIN {
                        ret = file->fs->v.write(file, data, size);
                } T_END;
+               if (!(ret < 0 && errno == EAGAIN))
+                       file->fs->stats.write_count++;
                return ret;
        }