virNetDevIsVirtualFunction() returns 1 if the interface is a
virtual function, 0 if it isn't and -1 on error. This means that,
despite the name suggesting otherwise, using it as a predicate is
not correct.
Fix two callers that were doing so adding an explicit check on
the return value.
int ret = -1;
char *pfdevname = NULL;
- if (vf == -1 && virNetDevIsVirtualFunction(linkdev)) {
+ if (vf == -1 && virNetDevIsVirtualFunction(linkdev) == 1) {
/* If this really *is* a VF and the caller just didn't know
* it, we should set the MAC address via PF+vf# instead of
* setting directly via VF, because the latter will be
char *pfdevname = NULL;
const char *vfdevname = NULL;
- if (vf == -1 && virNetDevIsVirtualFunction(linkdev)) {
+ if (vf == -1 && virNetDevIsVirtualFunction(linkdev) == 1) {
/* If this really *is* a VF and the caller just didn't know
* it, we should set the MAC address via PF+vf# instead of
* setting directly via VF, because the latter will be