Actually use the log cleaner introduced by previous commit.
Signed-off-by: Oleg Vasilev <oleg.vasilev(a)virtuozzo.com>
---
src/logging/log_handler.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/src/logging/log_handler.c b/src/logging/log_handler.c
index 8fc7e9b2a8..a739211c7c 100644
--- a/src/logging/log_handler.c
+++ b/src/logging/log_handler.c
@@ -21,6 +21,7 @@
#include <config.h>
#include "log_handler.h"
+#include "log_cleaner.h"
#include "virerror.h"
#include "virfile.h"
#include "viralloc.h"
@@ -175,7 +176,15 @@ virLogHandlerNew(bool privileged,
handler->inhibitor = inhibitor;
handler->opaque = opaque;
+ if (virLogCleanerInit(handler) < 0) {
+ goto error;
+ }
+
return handler;
+
+ error:
+ virObjectUnref(handler);
+ return NULL;
}
@@ -313,6 +322,8 @@ virLogHandlerDispose(void *obj)
virLogHandler *handler = obj;
size_t i;
+ virLogCleanerShutdown(handler);
+
for (i = 0; i < handler->nfiles; i++) {
handler->inhibitor(false, handler->opaque);
virLogHandlerLogFileFree(handler->files[i]);
--
2.38.1