virDomainNetType actualType = virDomainNetGetActualType(net);
if (net->model == VIR_DOMAIN_NET_MODEL_VIRTIO) {
- if (VIR_STRDUP(nic_model, "virtio-net") < 0)
- return -1;
+ nic_model = g_strdup("virtio-net");
} else if (net->model == VIR_DOMAIN_NET_MODEL_E1000) {
if ((bhyveDriverGetCaps(conn) & BHYVE_CAP_NET_E1000) != 0) {
- if (VIR_STRDUP(nic_model, "e1000") < 0)
- return -1;
+ nic_model = g_strdup("e1000");
} else {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("NIC model 'e1000' is not supported "
}
if (actualType == VIR_DOMAIN_NET_TYPE_BRIDGE) {
- if (VIR_STRDUP(brname, virDomainNetGetActualBridgeName(net)) < 0)
- goto cleanup;
+ brname = g_strdup(virDomainNetGetActualBridgeName(net));
} else {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Network type %d is not supported"),
STRPREFIX(net->ifname, VIR_NET_GENERATED_TAP_PREFIX) ||
strchr(net->ifname, '%')) {
VIR_FREE(net->ifname);
- if (VIR_STRDUP(net->ifname, VIR_NET_GENERATED_TAP_PREFIX "%d") < 0)
- goto cleanup;
+ net->ifname = g_strdup(VIR_NET_GENERATED_TAP_PREFIX "%d");
}
if (!dryRun) {
if (virNetDevSetOnline(net->ifname, true) != 0)
goto cleanup;
} else {
- if (VIR_STRDUP(realifname, "tap0") < 0)
- goto cleanup;
+ realifname = g_strdup("tap0");
}
goto error;
}
- if (VIR_STRDUP(chr->source->data.nmdm.master, param) < 0) {
- virDomainChrDefFree(chr);
- goto error;
- }
-
- if (VIR_STRDUP(chr->source->data.nmdm.slave, chr->source->data.file.path)
- < 0) {
- virDomainChrDefFree(chr);
- goto error;
- }
+ chr->source->data.nmdm.master = g_strdup(param);
+ chr->source->data.nmdm.slave = g_strdup(chr->source->data.file.path);
/* If the last character of the master is 'A', the slave will be 'B'
* and vice versa */
if (bus == VIR_DOMAIN_DISK_BUS_VIRTIO) {
idx = *nvirtiodisk;
*nvirtiodisk += 1;
- if (VIR_STRDUP(disk->dst, "vda") < 0)
- goto error;
+ disk->dst = g_strdup("vda");
} else if (bus == VIR_DOMAIN_DISK_BUS_SATA) {
idx = *nahcidisk;
*nahcidisk += 1;
- if (VIR_STRDUP(disk->dst, "sda") < 0)
- goto error;
+ disk->dst = g_strdup("sda");
}
if (idx > 'z' - 'a') {
* guess the actual bridge name from the command line,
* try to come up with some reasonable defaults */
net->type = VIR_DOMAIN_NET_TYPE_BRIDGE;
- if (VIR_STRDUP(net->data.bridge.brname, "virbr0") < 0)
- goto error;
+ net->data.bridge.brname = g_strdup("virbr0");
net->model = model;
net->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
}
if (def->name == NULL) {
- if (VIR_STRDUP(def->name, argv[argc]) < 0)
- goto error;
+ def->name = g_strdup(argv[argc]);
} else if (STRNEQ(def->name, argv[argc])) {
/* the vm name of the loader and the bhyverun command differ, throw an
* error here */
if (arguments != 3) {
/* Set os.bootloader since virDomainDefFormatInternal will only format
* the bootloader arguments if os->bootloader is set. */
- if (VIR_STRDUP(def->os.bootloader, argv[0]) < 0)
- goto error;
-
+ def->os.bootloader = g_strdup(argv[0]);
def->os.bootloaderArgs = virStringListJoin((const char**) &argv[1], " ");
}
if (def->name == NULL) {
- if (VIR_STRDUP(def->name, argv[argc]) < 0)
- goto error;
+ def->name = g_strdup(argv[argc]);
} else if (STRNEQ(def->name, argv[argc])) {
/* the vm name of the loader and the bhyverun command differ, throw an
* error here */
if (!argv)
goto error;
- if (VIR_STRDUP(def->os.bootloader, argv[0]) < 0)
- goto error;
-
+ def->os.bootloader = g_strdup(argv[0]);
def->os.bootloaderArgs = virStringListJoin((const char**) &argv[1], " ");
return 0;