summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2015-07-08 15:35:37 +0200
committerZdenek Kabelac <zkabelac@redhat.com>2015-07-08 15:41:48 +0200
commitfd37eeddd6b3901da806d536f44d43070e4fb660 (patch)
treeec1a3a94496a9eb5079a4d4c37b5340865fecd95
parent6b48233f2548621c42129b8f0e2911e05c206660 (diff)
downloadlvm2-fd37eeddd6b3901da806d536f44d43070e4fb660.tar.gz
coverity: fix regresions from 16e9b32c2f1
16e9b32c2f1a2d7e0f05a88981824ef0e7607965 incorrectly moved free of opened descriptor out of if{} - resulted of closing random file handle.
-rw-r--r--lib/log/log.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/log/log.c b/lib/log/log.c
index e3570d462..a439d1da3 100644
--- a/lib/log/log.c
+++ b/lib/log/log.c
@@ -101,10 +101,11 @@ void init_log_file(const char *log_file, int append)
append = 1; /* force */
}
}
+
+ if (st && fclose(st))
+ log_sys_debug("fclose", statfile);
}
- if (st && fclose(st))
- log_sys_debug("fclose", statfile);
no_epoch:
if (!(_log_file = fopen(log_file, append ? "a" : "w"))) {
log_sys_error("fopen", log_file);