virDomainXMLOptionPtr xmlopt,
unsigned int flags)
{
- const char *format;
bool inactive = flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE;
if (!backingStore)
return 0;
}
- if (backingStore->format <= 0 ||
- !(format = virStorageFileFormatTypeToString(backingStore->format))) {
+ if (backingStore->format <= 0 || backingStore->format >= VIR_STORAGE_FILE_LAST) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected disk backing store format %d"),
backingStore->format);
virBufferAddLit(buf, ">\n");
virBufferAdjustIndent(buf, 2);
- virBufferAsprintf(buf, "<format type='%s'/>\n", format);
+ virBufferAsprintf(buf, "<format type='%s'/>\n",
+ virStorageFileFormatTypeToString(backingStore->format));
if (virDomainDiskSourceFormat(buf, backingStore, 0, false, flags, xmlopt) < 0 ||
virDomainDiskBackingStoreFormat(buf, backingStore->backingStore,
xmlopt, flags) < 0)