dataLen = G_N_ELEMENTS(fullVPDExample) - 2;
buf = g_malloc0(dataLen);
- fd = virCreateAnonymousFile(fullVPDExample, dataLen);
+ if ((fd = virCreateAnonymousFile(fullVPDExample, dataLen)) < 0)
+ return -1;
readBytes = virPCIVPDReadVPDBytes(fd, buf, dataLen, 0, &csum);
};
dataLen = G_N_ELEMENTS(stringResExample);
- fd = virCreateAnonymousFile(stringResExample, dataLen);
+ if ((fd = virCreateAnonymousFile(stringResExample, dataLen)) < 0)
+ return -1;
+
result = virPCIVPDParseVPDLargeResourceString(fd, 0, dataLen, &csum, res);
VIR_FORCE_CLOSE(fd);
};
dataLen = G_N_ELEMENTS(fullVPDExample);
- fd = virCreateAnonymousFile(fullVPDExample, dataLen);
+ if ((fd = virCreateAnonymousFile(fullVPDExample, dataLen)) < 0)
+ return -1;
+
res = virPCIVPDParse(fd);
VIR_FORCE_CLOSE(fd);
};
dataLen = G_N_ELEMENTS(fullVPDExample);
- fd = virCreateAnonymousFile(fullVPDExample, dataLen);
+ if ((fd = virCreateAnonymousFile(fullVPDExample, dataLen)) < 0)
+ return -1;
+
res = virPCIVPDParse(fd);
VIR_FORCE_CLOSE(fd);
};
dataLen = G_N_ELEMENTS(fullVPDExample);
- fd = virCreateAnonymousFile(fullVPDExample, dataLen);
+ if ((fd = virCreateAnonymousFile(fullVPDExample, dataLen)) < 0)
+ return -1;
+
res = virPCIVPDParse(fd);
VIR_FORCE_CLOSE(fd);
};
dataLen = G_N_ELEMENTS(fullVPDExample);
- fd = virCreateAnonymousFile(fullVPDExample, dataLen);
+ if ((fd = virCreateAnonymousFile(fullVPDExample, dataLen)) < 0)
+ return -1;
+
res = virPCIVPDParse(fd);
VIR_FORCE_CLOSE(fd);
};
dataLen = G_N_ELEMENTS(fullVPDExample);
- fd = virCreateAnonymousFile(fullVPDExample, dataLen);
+ if ((fd = virCreateAnonymousFile(fullVPDExample, dataLen)) < 0)
+ return -1;
+
res = virPCIVPDParse(fd);
VIR_FORCE_CLOSE(fd);
g_autoptr(virPCIVPDResource) res = NULL; \
const uint8_t testCase[] = { invalidVPD }; \
dataLen = G_N_ELEMENTS(testCase); \
- fd = virCreateAnonymousFile(testCase, dataLen); \
+ if ((fd = virCreateAnonymousFile(testCase, dataLen)) < 0) \
+ return -1; \
if ((res = virPCIVPDParse(fd))) { \
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", \
"Successfully parsed an invalid VPD - this is not expected"); \