1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

bache: fix error return value

Return 0 as failure (as checked for).
Also add INTERNAL_ERROR if  'DI' would be -1.
This commit is contained in:
Zdenek Kabelac 2020-09-19 23:00:50 +02:00
parent 6b168afcad
commit 6c769eb460

View File

@ -1514,7 +1514,11 @@ void bcache_clear_fd(int di)
int bcache_change_fd(int di, int fd)
{
if (di >= _fd_table_size)
return -1;
return 0;
if (di < 0) {
log_error(INTERNAL_ERROR "Cannot change not openned DI with FD:%d", fd);
return 0;
}
_fd_table[di] = fd;
return 1;
}