1
0
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:
Bryn M. Reeves 2017-03-29 17:04:55 +01:00
parent 43fdbb8aeb
commit 70bb726678

View File

@ -566,12 +566,14 @@ static int _filemap_monitor_check_file_unlinked(struct filemap_monitor *fm)
if ((fd = open(fm->path, O_RDONLY)) < 0) if ((fd = open(fm->path, O_RDONLY)) < 0)
goto check_unlinked; goto check_unlinked;
if ((same = _filemap_monitor_check_same_file(fm->fd, fd)) < 0) same = _filemap_monitor_check_same_file(fm->fd, fd);
return 0;
if (close(fd)) if (close(fd))
log_error("Error closing fd %d", fd); log_error("Error closing fd %d", fd);
if (same < 0)
return 0;
if (same) if (same)
return 1; return 1;