[libvirt] [[PATCH v2] 2/4] virtlogd: stop reading on EOF instead of hangup

Nikolay Shirokovskiy nshirokovskiy at virtuozzo.com
Mon Sep 12 14:34:41 UTC 2016


Otherwise we can miss log tail. Handling hangup in a special
way in not nessessary.
---
 src/logging/log_handler.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/logging/log_handler.c b/src/logging/log_handler.c
index cd0ba6e..ca294a0 100644
--- a/src/logging/log_handler.c
+++ b/src/logging/log_handler.c
@@ -140,7 +140,7 @@ virLogHandlerGetLogFileFromWatch(virLogHandlerPtr handler,
 static void
 virLogHandlerDomainLogFileEvent(int watch,
                                 int fd,
-                                int events,
+                                int events ATTRIBUTE_UNUSED,
                                 void *opaque)
 {
     virLogHandlerPtr handler = opaque;
@@ -167,12 +167,12 @@ virLogHandlerDomainLogFileEvent(int watch,
         goto error;
     }
 
+    if (len == 0)
+        goto error;
+
     if (virRotatingFileWriterAppend(logfile->file, buf, len) != len)
         goto error;
 
-    if (events & VIR_EVENT_HANDLE_HANGUP)
-        goto error;
-
     virObjectUnlock(handler);
     return;
 
-- 
1.8.3.1




More information about the libvir-list mailing list