Re: [libvirt] Miscellaneous fixes to build with -Werror

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

 



Charles Duffy wrote:
> 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;

Looking at this more, I'm not sure.  The comment above GET_CONF_INT(log_level)
looks to be bogus; GET_CONF_INT does *not* return 0 if the value is not in the
config file, it doesn't change anything at all.  Still, I don't quite know the
reasoning behind the original change (back in early August), so I'm
uncomfortable changing it.

> 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;

Mark McLoughlin pushed this one.

> 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;

I just pushed this one because it's an obvious bugfix.

-- 
Chris Lalancette

--
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]