From 6c6e0b09a1af6df1ba966e634b9c91594a3fe7bf Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Mon, 10 Mar 2025 14:20:00 +0100 Subject: [PATCH] os: auth: let GenerateAuthorization() return 0 on error XID = 0 already is used as sign for error in several places, so let's use that here, too. Signed-off-by: Enrico Weigelt, metux IT consult --- Xext/security.c | 2 +- hw/xwin/winauth.c | 2 +- os/auth.c | 2 +- os/mitauth.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Xext/security.c b/Xext/security.c index 54bd4efab..cfa52d701 100644 --- a/Xext/security.c +++ b/Xext/security.c @@ -491,7 +491,7 @@ ProcSecurityGenerateAuthorization(ClientPtr client) authId = GenerateAuthorization(stuff->nbytesAuthProto, protoname, stuff->nbytesAuthData, protodata, &authdata_len, &pAuthdata); - if ((XID) ~0L == authId) { + if (!authId) { return SecurityErrorBase + XSecurityBadAuthorizationProtocol; } diff --git a/hw/xwin/winauth.c b/hw/xwin/winauth.c index c16e63e87..2ba592fee 100644 --- a/hw/xwin/winauth.c +++ b/hw/xwin/winauth.c @@ -68,7 +68,7 @@ winGenerateAuthorization(void) g_authId = GenerateAuthorization(strlen(AUTH_NAME), AUTH_NAME, 0, NULL, &g_uiAuthDataLen, &g_pAuthData); - if ((XID) ~0L == g_authId) { + if (!g_authId) { ErrorF("winGenerateAuthorization - GenerateAuthorization failed\n"); return FALSE; } diff --git a/os/auth.c b/os/auth.c index d79cbb8b0..28b2c6246 100644 --- a/os/auth.c +++ b/os/auth.c @@ -293,5 +293,5 @@ GenerateAuthorization(unsigned name_length, data_length_return, data_return); } } - return -1; + return 0; } diff --git a/os/mitauth.c b/os/mitauth.c index 0d960039f..867e0cb02 100644 --- a/os/mitauth.c +++ b/os/mitauth.c @@ -161,7 +161,7 @@ MitGenerateCookie(unsigned data_length, GenerateRandomData(sizeof(cookie), cookie); XID id = MitAddCookie(sizeof(cookie), cookie); if (!id) - return -1; + return 0; *data_return = cookie; *data_length_return = sizeof(cookie);