[PATCH] virlog: Enclose part of virLogDefineOutputs in HAVE_SYSLOG_H block

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Commit 640b58ab broke the mingw build because it referenced 'current_ident'
as well as 'openlog' symbols both of which are declared conditionally within
HAVE_SYSLOG_H directive. This patch fixes the broken build. Additional changes
like moving all variable declarations in virLogDefineOutputs into the
conditional block were necessary to avoid 'unused variable' errors from mingw.

Signed-off-by: Erik Skultety <eskultet@xxxxxxxxxx>
---
I could've pushed it under build breaker rule but I'd rather be safe than sorry
that I missed anything else.

Erik


 src/util/virlog.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/src/util/virlog.c b/src/util/virlog.c
index 14ee701..f52d9d8 100644
--- a/src/util/virlog.c
+++ b/src/util/virlog.c
@@ -1362,16 +1362,15 @@ virLogFindOutput(virLogOutputPtr *outputs, size_t noutputs,
 int
 virLogDefineOutputs(virLogOutputPtr *outputs, size_t noutputs)
 {
-    int ret = -1;
-    int id;
+    if (virLogInitialize() < 0)
+        return -1;
+
+    virLogLock();
+    virLogResetOutputs();
+
+#if HAVE_SYSLOG_H
+    int id = -1;
     char *tmp = NULL;
-
-    if (virLogInitialize() < 0)
-        return -1;
-
-    virLogLock();
-    virLogResetOutputs();
-
     /* syslog needs to be special-cased, since it keeps the fd in private */
     if ((id = virLogFindOutput(outputs, noutputs, VIR_LOG_TO_SYSLOG,
                                current_ident)) != -1) {
@@ -1379,20 +1378,21 @@ virLogDefineOutputs(virLogOutputPtr *outputs, size_t noutputs)
          * holding the lock so it's safe to call openlog and change the message
          * tag
          */
-        if (VIR_STRDUP_QUIET(tmp, outputs[id]->name) < 0)
-            goto cleanup;
+        if (VIR_STRDUP_QUIET(tmp, outputs[id]->name) < 0) {
+            virLogUnlock();
+            return -1;
+        }
         VIR_FREE(current_ident);
         current_ident = tmp;
         openlog(current_ident, 0, 0);
     }
+#endif
 
     virLogOutputs = outputs;
     virLogNbOutputs = noutputs;
 
-    ret = 0;
- cleanup:
     virLogUnlock();
-    return ret;
+    return 0;
 }
 
 
-- 
2.5.5

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]