summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdriana Kobylak <anoo@us.ibm.com>2018-05-23 12:58:19 -0500
committerAdriana Kobylak <anoo@us.ibm.com>2018-05-23 13:01:09 -0500
commit4a029f2f401a6738c6daa31ad3098eb7f0915c7c (patch)
treed7b236516d303259b0b7b3c93c27c4c5837375e6
parenta8808b85154ec9d5b3590d9163bd87b55af96dfa (diff)
downloadphosphor-logging-4a029f2f401a6738c6daa31ad3098eb7f0915c7c.zip
phosphor-logging-4a029f2f401a6738c6daa31ad3098eb7f0915c7c.tar.gz
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>
-rw-r--r--log_manager.cpp7
1 files changed, 5 insertions, 2 deletions
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 @@ void Manager::journalSync()
;
}
- if ((fd != -1) && (wd != -1))
+ if (fd != -1)
{
- inotify_rm_watch(fd, wd);
+ if (wd != -1)
+ {
+ inotify_rm_watch(fd, wd);
+ }
close(fd);
}
OpenPOWER on IntegriCloud