mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
error: Drop some obviously superfluous error_propagate()
When error_propagate(errp, local_err) is the only reader of @local_err, we can just as well change its writers to write @errp directly, and drop the error_propagate() along with @local_err. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20221121085054.683122-2-armbru@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
This commit is contained in:
parent
3d558330ad
commit
6c37ebf330
3 changed files with 11 additions and 19 deletions
|
@ -275,13 +275,12 @@ static void acquire_privilege(const char *name, Error **errp)
|
|||
{
|
||||
HANDLE token = NULL;
|
||||
TOKEN_PRIVILEGES priv;
|
||||
Error *local_err = NULL;
|
||||
|
||||
if (OpenProcessToken(GetCurrentProcess(),
|
||||
TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &token))
|
||||
{
|
||||
if (!LookupPrivilegeValue(NULL, name, &priv.Privileges[0].Luid)) {
|
||||
error_setg(&local_err, QERR_QGA_COMMAND_FAILED,
|
||||
error_setg(errp, QERR_QGA_COMMAND_FAILED,
|
||||
"no luid for requested privilege");
|
||||
goto out;
|
||||
}
|
||||
|
@ -290,13 +289,13 @@ static void acquire_privilege(const char *name, Error **errp)
|
|||
priv.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
|
||||
|
||||
if (!AdjustTokenPrivileges(token, FALSE, &priv, 0, NULL, 0)) {
|
||||
error_setg(&local_err, QERR_QGA_COMMAND_FAILED,
|
||||
error_setg(errp, QERR_QGA_COMMAND_FAILED,
|
||||
"unable to acquire requested privilege");
|
||||
goto out;
|
||||
}
|
||||
|
||||
} else {
|
||||
error_setg(&local_err, QERR_QGA_COMMAND_FAILED,
|
||||
error_setg(errp, QERR_QGA_COMMAND_FAILED,
|
||||
"failed to open privilege token");
|
||||
}
|
||||
|
||||
|
@ -304,7 +303,6 @@ out:
|
|||
if (token) {
|
||||
CloseHandle(token);
|
||||
}
|
||||
error_propagate(errp, local_err);
|
||||
}
|
||||
|
||||
static void execute_async(DWORD WINAPI (*func)(LPVOID), LPVOID opaque,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue