[libvirt] [PATCH] virnetdevtap: Don't crash on !ifname in virNetDevTapInterfaceStats
Andrea Bolognani
abologna at redhat.com
Fri Jul 13 11:28:35 UTC 2018
On Fri, 2018-07-13 at 11:24 +0200, Michal Privoznik wrote:
[...]
> + if (!ifname) {
> + virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
> + _("Interface not found"));
> + return -1;
> + }
I would use something like "Interface name not provided" here,
as it would better describe the cause of the error.
[...]
> if (ifa->ifa_addr->sa_family != AF_LINK)
> continue;
>
> - if (STREQ(ifa->ifa_name, ifname)) {
> + if (STREQ_NULLABLE(ifa->ifa_name, ifname)) {
Why is the fix different for the BSD implementation? I would
expect you to just add the same snippet as above to guard the
rest of the function from ifname being NULL...
--
Andrea Bolognani / Red Hat / Virtualization
More information about the libvir-list
mailing list