virReportSystemError(errno,
_("cannot open path '%s'"),
pool->def->target.path);
- goto cleanup;
+ goto error;
}
while ((direrr = virDirRead(dir, &ent, pool->def->target.path)) > 0) {
int backingStoreFormat;
if (VIR_ALLOC(vol) < 0)
- goto cleanup;
+ goto error;
if (VIR_STRDUP(vol->name, ent->d_name) < 0)
- goto cleanup;
+ goto error;
vol->type = VIR_STORAGE_VOL_FILE;
vol->target.format = VIR_STORAGE_FILE_RAW; /* Real value is filled in during probe */
if (virAsprintf(&vol->target.path, "%s/%s",
pool->def->target.path,
vol->name) == -1)
- goto cleanup;
+ goto error;
if (VIR_STRDUP(vol->key, vol->target.path) < 0)
- goto cleanup;
+ goto error;
if ((ret = virStorageBackendProbeTarget(&vol->target,
&backingStore,
* break virStorageVolTargetDefFormat() generating the line
* <format type='...'/>. */
backingStoreFormat = VIR_STORAGE_FILE_RAW;
- } else
- goto cleanup;
+ } else {
+ goto error;
+ }
}
/* directory based volume */
if (backingStore != NULL) {
if (VIR_ALLOC(vol->target.backingStore) < 0)
- goto cleanup;
+ goto error;
vol->target.backingStore->path = backingStore;
vol->target.backingStore->format = backingStoreFormat;
if (VIR_APPEND_ELEMENT(pool->volumes.objs, pool->volumes.count, vol) < 0)
- goto cleanup;
+ goto error;
}
if (direrr < 0)
- goto cleanup;
+ goto error;
closedir(dir);
if (statvfs(pool->def->target.path, &sb) < 0) {
return 0;
- cleanup:
+ error:
if (dir)
closedir(dir);
virStorageVolDefFree(vol);