mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-25 21:02:22 +00:00
qemu: Don't overwrite error from qemuSecurityCommandRun()
The usual pattern when starting a helper daemon is: if (qemuSecurityCommandRun(..., &exitstatus, &cmdret) < 0) goto cleanup; if (cmdret < 0 || exitstatus != 0) { virReportError(); goto cleanup; } The only problem with this pattern is that if virCommandRun() fails (i.e. cmdret < 0), then proper error was already reported. But in this pattern we overwrite it (usually with less specific) error. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
0634d640d6
commit
17ffdbab1f
@ -224,8 +224,10 @@ qemuDBusStart(virQEMUDriver *driver,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (cmdret < 0 || exitstatus != 0) {
|
if (cmdret < 0 || exitstatus != 0) {
|
||||||
|
if (cmdret >= 0) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Could not start dbus-daemon. exitstatus: %d"), exitstatus);
|
_("Could not start dbus-daemon. exitstatus: %d"), exitstatus);
|
||||||
|
}
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -289,8 +289,10 @@ qemuPasstStart(virDomainObj *vm,
|
|||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (cmdret < 0 || exitstatus != 0) {
|
if (cmdret < 0 || exitstatus != 0) {
|
||||||
|
if (cmdret >= 0) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Could not start 'passt': %s"), NULLSTR(errbuf));
|
_("Could not start 'passt': %s"), NULLSTR(errbuf));
|
||||||
|
}
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -626,10 +626,11 @@ qemuSecurityDomainRestorePathLabel(virQEMUDriver *driver,
|
|||||||
* @cmdret: pointer to int returning result of virCommandRun
|
* @cmdret: pointer to int returning result of virCommandRun
|
||||||
*
|
*
|
||||||
* Run @cmd with seclabels set on it. If @uid and/or @gid are not
|
* Run @cmd with seclabels set on it. If @uid and/or @gid are not
|
||||||
* -1 then their value is enforced.
|
* -1 then their value is enforced. If @cmdret is negative upon
|
||||||
|
* return, then appropriate error was already reported.
|
||||||
*
|
*
|
||||||
* Returns: 0 on success,
|
* Returns: 0 on success,
|
||||||
* -1 otherwise.
|
* -1 otherwise (with error reported).
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
qemuSecurityCommandRun(virQEMUDriver *driver,
|
qemuSecurityCommandRun(virQEMUDriver *driver,
|
||||||
|
@ -331,8 +331,10 @@ qemuSlirpStart(virDomainObj *vm,
|
|||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (cmdret < 0 || exitstatus != 0) {
|
if (cmdret < 0 || exitstatus != 0) {
|
||||||
|
if (cmdret >= 0) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Could not start 'slirp'. exitstatus: %d"), exitstatus);
|
_("Could not start 'slirp'. exitstatus: %d"), exitstatus);
|
||||||
|
}
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,8 +157,10 @@ int qemuExtVhostUserGPUStart(virQEMUDriver *driver,
|
|||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (cmdret < 0 || exitstatus != 0) {
|
if (cmdret < 0 || exitstatus != 0) {
|
||||||
|
if (cmdret >= 0) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Could not start 'vhost-user-gpu'. exitstatus: %d"), exitstatus);
|
_("Could not start 'vhost-user-gpu'. exitstatus: %d"), exitstatus);
|
||||||
|
}
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user