virsh: Adapt to new HW address scenario

Make sure we don't print (null) (which in fact is printf()'s
cleverness anyway, not ours). If no HW address is present, print
"N/A" string just like we do for other fields.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Michal Privoznik 2015-03-17 17:28:53 +01:00
parent 3640245db7
commit 50780207ef

View File

@ -2278,7 +2278,8 @@ cmdDomIfAddr(vshControl *ctl, const vshCmd *cmd)
/* When the interface has no IP address */
if (!iface->naddrs) {
vshPrintExtra(ctl, " %-10s %-17s %-12s %s\n",
iface->name, iface->hwaddr, "N/A", "N/A");
iface->name,
iface->hwaddr ? iface->hwaddr : "N/A", "N/A", "N/A");
continue;
}
@ -2312,7 +2313,8 @@ cmdDomIfAddr(vshControl *ctl, const vshCmd *cmd)
/* Don't repeat interface name */
if (full || !j)
vshPrintExtra(ctl, " %-10s %-17s %s\n",
iface->name, iface->hwaddr, ip_addr_str);
iface->name,
iface->hwaddr ? iface->hwaddr : "", ip_addr_str);
else
vshPrintExtra(ctl, " %-10s %-17s %s\n",
"-", "-", ip_addr_str);