virTimeBackOffVar timebackoff;
const unsigned long long timeout = 500 * 1000; /* ms */
VIR_AUTOCLOSE errfd = -1;
- int cmdret = 0;
int exitstatus = 0;
pid_t cpid = -1;
int ret = -1;
virCommandDaemonize(cmd);
virCommandAddArgFormat(cmd, "--config-file=%s", configfile);
- if (qemuSecurityCommandRun(driver, vm, cmd, -1, -1,
- &exitstatus, &cmdret) < 0)
+ if (qemuSecurityCommandRun(driver, vm, cmd, -1, -1, &exitstatus) < 0)
goto cleanup;
- if (cmdret < 0 || exitstatus != 0) {
- if (cmdret >= 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Could not start dbus-daemon. exitstatus: %d"), exitstatus);
- }
+ if (exitstatus != 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not start dbus-daemon. exitstatus: %d"), exitstatus);
goto cleanup;
}
char macaddr[VIR_MAC_STRING_BUFLEN];
size_t i;
int exitstatus = 0;
- int cmdret = 0;
cmd = virCommandNew(PASST);
if (qemuExtDeviceLogCommand(driver, vm, cmd, "passt") < 0)
return -1;
- if (qemuSecurityCommandRun(driver, vm, cmd, -1, -1, &exitstatus, &cmdret) < 0)
+ if (qemuSecurityCommandRun(driver, vm, cmd, -1, -1, &exitstatus) < 0)
goto error;
- if (cmdret < 0 || exitstatus != 0) {
- if (cmdret >= 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Could not start 'passt': %s"), NULLSTR(errbuf));
- }
+ if (exitstatus != 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not start 'passt': %s"), NULLSTR(errbuf));
goto error;
}
* @uid: the uid to force
* @gid: the gid to force
* @existstatus: pointer to int returning exit status of process
- * @cmdret: pointer to int returning result of virCommandRun
*
* Run @cmd with seclabels set on it. If @uid and/or @gid are not
- * -1 then their value is enforced. If @cmdret is negative upon
- * return, then appropriate error was already reported.
+ * -1 then their value is enforced.
*
* Returns: 0 on success,
* -1 otherwise (with error reported).
virCommand *cmd,
uid_t uid,
gid_t gid,
- int *exitstatus,
- int *cmdret)
+ int *exitstatus)
{
g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
qemuDomainObjPrivate *priv = vm->privateData;
+ int ret = -1;
if (virSecurityManagerSetChildProcessLabel(driver->securityManager,
vm->def, cmd) < 0)
if (virSecurityManagerPreFork(driver->securityManager) < 0)
return -1;
- *cmdret = virCommandRun(cmd, exitstatus);
+ ret = virCommandRun(cmd, exitstatus);
virSecurityManagerPostFork(driver->securityManager);
- return 0;
+ return ret;
}
virCommand *cmd,
uid_t uid,
gid_t gid,
- int *exitstatus,
- int *cmdret);
+ int *exitstatus);
/* Please note that for these APIs there is no wrapper yet. Do NOT blindly add
* new APIs here. If an API can touch a file add a proper wrapper instead.
pid_t pid = (pid_t) -1;
int rc;
int exitstatus = 0;
- int cmdret = 0;
bool killDBusDaemon = false;
g_autofree char *fdname = g_strdup_printf("slirpfd-%s", net->info.alias);
if (qemuExtDeviceLogCommand(driver, vm, cmd, "slirp") < 0)
goto error;
- if (qemuSecurityCommandRun(driver, vm, cmd, -1, -1, &exitstatus, &cmdret) < 0)
+ if (qemuSecurityCommandRun(driver, vm, cmd, -1, -1, &exitstatus) < 0)
goto error;
- if (cmdret < 0 || exitstatus != 0) {
- if (cmdret >= 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Could not start 'slirp'. exitstatus: %d"), exitstatus);
- }
+ if (exitstatus != 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not start 'slirp'. exitstatus: %d"), exitstatus);
goto error;
}
virTimeBackOffVar timebackoff;
const unsigned long long timeout = 1000; /* ms */
bool setTPMStateLabel = true;
- int cmdret = 0;
pid_t pid = -1;
cfg = virQEMUDriverGetConfig(driver);
return -1;
if (qemuSecurityCommandRun(driver, vm, cmd, cfg->swtpm_user,
- cfg->swtpm_group, NULL, &cmdret) < 0)
+ cfg->swtpm_group, NULL) < 0)
goto error;
- if (cmdret < 0) {
- /* virCommandRun() hidden in qemuSecurityCommandRun()
- * already reported error. */
- goto error;
- }
-
if (virPidFileReadPath(pidfile, &pid) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("swtpm didn't show up"));
g_autofree char *pidfile = NULL;
g_autoptr(virCommand) cmd = NULL;
int pair[2] = { -1, -1 };
- int cmdret = 0, rc;
+ int rc;
int exitstatus = 0;
pid_t pid;
int ret = -1;
virCommandAddArgFormat(cmd, "--render-node=%s", video->accel->rendernode);
}
- if (qemuSecurityCommandRun(driver, vm, cmd, -1, -1, &exitstatus, &cmdret) < 0)
+ if (qemuSecurityCommandRun(driver, vm, cmd, -1, -1, &exitstatus) < 0)
goto error;
- if (cmdret < 0 || exitstatus != 0) {
- if (cmdret >= 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Could not start 'vhost-user-gpu'. exitstatus: %d"), exitstatus);
- }
+ if (exitstatus != 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not start 'vhost-user-gpu'. exitstatus: %d"), exitstatus);
goto cleanup;
}