[PATCH 2/5] virsh: Adapt to new HW address scenario

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

 



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@xxxxxxxxxx>
---
 tools/virsh-domain-monitor.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c
index c9bf156..0717076 100644
--- a/tools/virsh-domain-monitor.c
+++ b/tools/virsh-domain-monitor.c
@@ -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);
-- 
2.0.5

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