Always call close on fd if file has been opened
The previous logic only called close if the file had been opened AND
there was a valid inotify watch handle. Even if there is not a watch
handle, the file should be closed.
Change-Id: Id1f6d441129e13c6a48d6156161425082aeba8e8
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
diff --git a/log_manager.cpp b/log_manager.cpp
index f808e4b..71858f6 100644
--- a/log_manager.cpp
+++ b/log_manager.cpp
@@ -438,9 +438,12 @@
;
}
- if ((fd != -1) && (wd != -1))
+ if (fd != -1)
{
- inotify_rm_watch(fd, wd);
+ if (wd != -1)
+ {
+ inotify_rm_watch(fd, wd);
+ }
close(fd);
}