]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
fs-randomfail: Set fs error always when injecting failure.
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 12 May 2016 11:15:41 +0000 (07:15 -0400)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 12 May 2016 11:39:00 +0000 (07:39 -0400)
It was done in some places, but not everywhere.

src/lib-fs/fs-randomfail.c

index 62999204b1d6be5c561e838b5bec74376901edba..c3132a53b0f432313d54dd946b458f22c063e754 100644 (file)
@@ -260,7 +260,11 @@ static bool fs_random_fail(struct fs *_fs, enum fs_op op)
 
        if (fs->op_probability[op] == 0)
                return FALSE;
-       return (unsigned int)(rand() % 100) <= fs->op_probability[op];
+       if ((unsigned int)(rand() % 100) <= fs->op_probability[op]) {
+               fs_set_error(_fs, RANDOMFAIL_ERROR);
+               return TRUE;
+       }
+       return FALSE;
 }
 
 static bool