[libvirt] Miscellaneous fixes to build with -Werror

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

 



HACKING suggests compiling with --enable-compile-warnings=error before submitting any patches; however, current master fails for me on this account (CentOS 5.3; gcc 4.1.2).

Please see attached. I suspect most of these should be uncontroversial -- but wonder if perhaps virStrcpy uses would be better converted to virStrcpyStatic rather than adding virStrcpy to the symbol list as done here, and am curious about whether the need for explicit initialization to silence a warning regarding qemudSetLogging's log_level indicates a bug in the macro later used to assign that value.
diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index 2bae782..ec2eab1 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -2492,7 +2492,7 @@ remoteReadSaslAllowedUsernameList (virConfPtr conf ATTRIBUTE_UNUSED,
  */
 static int
 qemudSetLogging(virConfPtr conf, const char *filename) {
-    int log_level;
+    int log_level = 0;
     char *log_filters = NULL;
     char *log_outputs = NULL;
     int ret = -1;
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index a6668f3..c6a9df3 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -413,6 +413,7 @@ virStrToLong_ll;
 virStrToLong_ull;
 virStrToLong_ui;
 virStrToDouble;
+virStrcpy;
 virFileLinkPointsTo;
 virFileResolveLink;
 saferead;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index af215ca..25d983e 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -6132,7 +6132,7 @@ static int qemudDomainDetachHostPciDevice(virConnectPtr conn,
                                           virDomainObjPtr vm,
                                           virDomainDeviceDefPtr dev)
 {
-    virDomainHostdevDefPtr detach;
+    virDomainHostdevDefPtr detach = NULL;
     char *cmd, *reply;
     int i, ret;
     pciDevice *pci;
diff --git a/src/secret/secret_driver.c b/src/secret/secret_driver.c
index 20a3fa8..9c4102e 100644
--- a/src/secret/secret_driver.c
+++ b/src/secret/secret_driver.c
@@ -432,7 +432,7 @@ static virSecretEntryPtr
 secretLoad(virConnectPtr conn, virSecretDriverStatePtr driver,
            const char *xml_basename)
 {
-    virSecretDefPtr def;
+    virSecretDefPtr def = NULL;
     virSecretEntryPtr secret = NULL, ret = NULL;
     char *xml_filename;
 
diff --git a/src/storage/parthelper.c b/src/storage/parthelper.c
index 5df46e8..ab04842 100644
--- a/src/storage/parthelper.c
+++ b/src/storage/parthelper.c
@@ -34,6 +34,7 @@
 
 #include <parted/parted.h>
 #include <stdio.h>
+#include <string.h>
 
 /* we don't need to include the full internal.h just for this */
 #define STREQ(a,b) (strcmp((a),(b)) == 0)
--
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]