mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
dmfilemapd: always close check file descriptor (coverity)
The daemon opens a new file descriptor from fm->path when checking for an unlinked file with mode=inode. Ensure that it is always closed even if the same file test fails.
This commit is contained in:
parent
43fdbb8aeb
commit
70bb726678
@ -566,12 +566,14 @@ static int _filemap_monitor_check_file_unlinked(struct filemap_monitor *fm)
|
||||
if ((fd = open(fm->path, O_RDONLY)) < 0)
|
||||
goto check_unlinked;
|
||||
|
||||
if ((same = _filemap_monitor_check_same_file(fm->fd, fd)) < 0)
|
||||
return 0;
|
||||
same = _filemap_monitor_check_same_file(fm->fd, fd);
|
||||
|
||||
if (close(fd))
|
||||
log_error("Error closing fd %d", fd);
|
||||
|
||||
if (same < 0)
|
||||
return 0;
|
||||
|
||||
if (same)
|
||||
return 1;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user