Re: [PATCH 11/13] Replace use of virNWFilterReportError with virReportError

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

 



On 07/18/2012 05:52 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>
> 
> Update the network filter driver to use virReportError instead
> of the virNWFilterReportError custom macro
> 
> Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
> ---

> +++ b/src/nwfilter/nwfilter_dhcpsnoop.c
> @@ -1097,35 +1093,35 @@ virNWFilterSnoopDHCPOpen(const char *ifname, virMacAddr *mac,
>      handle = pcap_create(ifname, pcap_errbuf);
>  
>      if (handle == NULL) {
> -        virNWFilterReportError(VIR_ERR_INTERNAL_ERROR,
> -                               _("pcap_create failed"));
> +        virReportError(VIR_ERR_INTERNAL_ERROR,
> +                       _("pcap_create failed"));

Missing a %s.

>          goto cleanup_nohandle;
>      }
>  
>      if (pcap_set_snaplen(handle, PCAP_PBUFSIZE) < 0 ||
>          pcap_set_buffer_size(handle, PCAP_BUFFERSIZE) < 0 ||
>          pcap_activate(handle) < 0) {
> -        virNWFilterReportError(VIR_ERR_INTERNAL_ERROR,
> -                               _("setup of pcap handle failed"));
> +        virReportError(VIR_ERR_INTERNAL_ERROR,
> +                       _("setup of pcap handle failed"));

and again.

> +++ b/src/nwfilter/nwfilter_ebiptables_driver.c
> @@ -2683,8 +2680,8 @@ ebiptablesCreateRuleInstance(enum virDomainNetType nettype ATTRIBUTE_UNUSED,
>      break;
>  
>      case VIR_NWFILTER_RULE_PROTOCOL_LAST:
> -        virNWFilterReportError(VIR_ERR_OPERATION_FAILED,
> -                               "%s", _("illegal protocol type"));
> +        virReportError(VIR_ERR_OPERATION_FAILED,
> +                       "%s", _("illegal protocol type"));

I hate the word 'illegal' in error messages - the user didn't break a
law, they just violated constraints.  'invalid' is nicer.  But that's a
separate cleanup.

> +++ b/src/nwfilter/nwfilter_learnipaddr.c
> @@ -151,17 +148,17 @@ virNWFilterLockIface(const char *ifname) {

>          if (virStrcpyStatic(ifaceLock->ifname, ifname) == NULL) {
> -            virNWFilterReportError(VIR_ERR_INTERNAL_ERROR,
> -                                   _("interface name %s does not fit into "
> -                                     "buffer "),
> -                                   ifaceLock->ifname);
> +            virReportError(VIR_ERR_INTERNAL_ERROR,
> +                           _("interface name %s does not fit into "
> +                             "buffer "),

This might fit in 80 columns without the split format string now.  But
rewrapping format strings is not necessary for this series.

ACK.

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

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