Mercurial > dovecot > core-2.2
changeset 21352:eb1ba71862e3
fs-randomfail: Fix failure handling for fs_read()
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Thu, 22 Dec 2016 11:58:29 -0500 |
parents | 10034ed9ee46 |
children | e14cd8964879 |
files | src/lib-fs/fs-randomfail.c |
diffstat | 1 files changed, 3 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-fs/fs-randomfail.c Wed Dec 21 20:56:58 2016 +0200 +++ b/src/lib-fs/fs-randomfail.c Thu Dec 22 11:58:29 2016 -0500 @@ -307,7 +307,9 @@ if (fs_file_random_fail_begin(file, FS_OP_READ)) return -1; ret = fs_read(_file->parent, buf, size); - return fs_file_random_fail_end(file, ret, FS_OP_READ); + if (fs_file_random_fail_end(file, ret < 0 ? -1 : 0, FS_OP_READ) < 0) + return -1; + return ret; } static struct istream *