Skip to content

Commit

Permalink
fs-randomfail: Fix failure handling for fs_read()
Browse files Browse the repository at this point in the history
  • Loading branch information
sirainen committed Dec 23, 2016
1 parent 2422b56 commit 2068fde
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/lib-fs/fs-randomfail.c
Expand Up @@ -307,7 +307,9 @@ static ssize_t fs_randomfail_read(struct fs_file *_file, void *buf, size_t size)
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 *
Expand Down

0 comments on commit 2068fde

Please sign in to comment.