From b76b97a5b240ecfdd38d34645caa930d0de2ff27 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Sun, 16 Aug 2015 13:07:21 +0200 Subject: [PATCH] lib-fs: fs_write() didn't update stats.write_count correctly. 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 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib-fs/fs-api.c b/src/lib-fs/fs-api.c index f1b6965afa..1e8c75856e 100644 --- a/src/lib-fs/fs-api.c +++ b/src/lib-fs/fs-api.c @@ -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; } -- 2.47.3