summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPatrick Ohly <patrick.ohly@intel.com>2013-03-19 14:56:10 +0100
committerPatrick Ohly <patrick.ohly@intel.com>2013-03-19 14:56:10 +0100
commit3ec359deede05524ea67b85ee52fffda30c87dbc (patch)
tree7d182071d84ae2ecd3bb94635016c5be49e747dd /test
parent81d1bef13c101bafeb618a9849b35416927e51cb (diff)
testing: avoid unlikely fd leak
If opening the server log file returned 0 as fd, the writing was skipped and the file was not closed. Found by Klocwork, unrealistic in practice.
Diffstat (limited to 'test')
-rw-r--r--test/ClientTest.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/test/ClientTest.cpp b/test/ClientTest.cpp
index e8c5c48a..5c2ec0df 100644
--- a/test/ClientTest.cpp
+++ b/test/ClientTest.cpp
@@ -6348,7 +6348,7 @@ void ClientTest::postSync(int res, const std::string &logname)
if (fd >= 0) {
int out = open((logname + ".server.log").c_str(), O_WRONLY|O_CREAT, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP);
- if (out) {
+ if (out >= 0) {
char buffer[4096];
bool cont = true;
ssize_t len;