diff options
author | Bryn M. Reeves <bmr@redhat.com> | 2017-03-29 17:04:55 +0100 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2017-03-29 18:33:53 +0100 |
commit | 70bb72667889a2d6f250437e5db247eb111ca1aa (patch) | |
tree | fc5f7fbf12fec2c0147754613f456fce86c20019 | |
parent | 43fdbb8aeb78f9ada5dc135fa421c344c8e998d3 (diff) | |
download | lvm2-70bb72667889a2d6f250437e5db247eb111ca1aa.tar.gz |
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.
-rw-r--r-- | daemons/dmfilemapd/dmfilemapd.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/daemons/dmfilemapd/dmfilemapd.c b/daemons/dmfilemapd/dmfilemapd.c index 0cb0ad713..3fd76b761 100644 --- a/daemons/dmfilemapd/dmfilemapd.c +++ b/daemons/dmfilemapd/dmfilemapd.c @@ -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; |