int newstdout = -1;
char *help = NULL;
enum { MAX_HELP_OUTPUT_SIZE = 1024*8 };
- int len;
char *start;
char *end;
char *tmp;
&child, -1, &newstdout, NULL, VIR_EXEC_CLEAR_CAPS) < 0)
goto cleanup;
- if ((len = virFileReadLimFD(newstdout, MAX_HELP_OUTPUT_SIZE, &help)) < 0) {
+ if (virFileReadLimFD(newstdout, MAX_HELP_OUTPUT_SIZE, &help) < 0) {
virReportSystemError(errno,
_("Unable to read '%s -h' output"),
qemuimg);
#define VIR_FROM_THIS VIR_FROM_STORAGE
-static int
+static int ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
virStorageBackendProbeTarget(virStorageVolTargetPtr target,
char **backingStore,
int *backingStoreFormat,
int fd, ret;
virStorageFileMetadata meta;
- if (backingStore)
- *backingStore = NULL;
- if (backingStoreFormat)
- *backingStoreFormat = VIR_STORAGE_FILE_AUTO;
+ *backingStore = NULL;
+ *backingStoreFormat = VIR_STORAGE_FILE_AUTO;
if (encryption)
*encryption = NULL;
allocation,
capacity)) < 0) {
close(fd);
- return -1;
+ return ret;
}
memset(&meta, 0, sizeof(meta));
close(fd);
if (meta.backingStore) {
- if (backingStore) {
- *backingStore = meta.backingStore;
- meta.backingStore = NULL;
- if (meta.backingStoreFormat == VIR_STORAGE_FILE_AUTO) {
- if ((*backingStoreFormat = virStorageFileProbeFormat(*backingStore)) < 0) {
- close(fd);
- goto cleanup;
- }
- } else {
- *backingStoreFormat = meta.backingStoreFormat;
+ *backingStore = meta.backingStore;
+ meta.backingStore = NULL;
+ if (meta.backingStoreFormat == VIR_STORAGE_FILE_AUTO) {
+ if ((*backingStoreFormat
+ = virStorageFileProbeFormat(*backingStore)) < 0) {
+ close(fd);
+ goto cleanup;
}
} else {
- VIR_FREE(meta.backingStore);
+ *backingStoreFormat = meta.backingStoreFormat;
}
+ } else {
+ VIR_FREE(meta.backingStore);
}
if (capacity && meta.capacity)
return 0;
cleanup:
- if (backingStore)
- VIR_FREE(*backingStore);
+ VIR_FREE(*backingStore);
return -1;
}