Commit id '
ac3ed2085' causes 'virsh nodedev-list --cap net' to fail
on any system without SYSFS_INFINIBAND_DIR (/sys/class/infiniband).
Rather than assume it's there and fail on the attempt to open the
non-existent directory, check if it's there - if not, return
success and move on. Also fix caller to check < 0 upon return.
As reported by Suren Hajyan <shajyan@redhat.com> from run of unit tests
struct dirent *dp;
int ret = -1;
+ if (!virFileExists(SYSFS_INFINIBAND_DIR))
+ return 0;
+
if (!(dirp = opendir(SYSFS_INFINIBAND_DIR))) {
virReportSystemError(errno,
_("Failed to opendir path '%s'"),
ignore_value(virBitmapSetBit(*out, VIR_NET_DEV_FEAT_TXUDPTNL));
# endif
- if (virNetDevRDMAFeature(ifname, out))
+ if (virNetDevRDMAFeature(ifname, out) < 0)
return -1;
return 0;
}