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:
Markus Armbruster 2022-11-21 09:50:45 +01:00
parent 3d558330ad
commit 6c37ebf330
3 changed files with 11 additions and 19 deletions

View file

@ -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,