From 35d72a759a5bb6d7d4accf3ec66d584ad1bf8568 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Mon, 25 Aug 2025 10:44:32 +0200 Subject: [PATCH] dix: let X_SEND_REPLY_WITH_RPCBUF() return status code Check for rpcbuf error and return BadAlloc then, otherwise return Success. This way, callers don't need to check their rpcbuf for error on their own anymore, but can just do return X_SEND_REPLY_WITH_RPCBUF(...). Signed-off-by: Enrico Weigelt, metux IT consult --- dix/dix_priv.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dix/dix_priv.h b/dix/dix_priv.h index bdb90a4df..9a6023708 100644 --- a/dix/dix_priv.h +++ b/dix/dix_priv.h @@ -748,9 +748,12 @@ static inline Atom dixGetAtomID(const char *name) { #define X_REPLY_HEADER_UNITS(hdrtype) \ (pad_to_int32((sizeof(hdrtype) - sizeof(xGenericReply)))) -static inline void __write_reply_hdr_and_rpcbuf( +static inline int __write_reply_hdr_and_rpcbuf( ClientPtr pClient, void *hdrData, size_t hdrLen, x_rpcbuf_t *rpcbuf) { + if (rpcbuf->error) + return BadAlloc; + xGenericReply *reply = hdrData; reply->type = X_Reply; reply->length = (bytes_to_int32(hdrLen - sizeof(xGenericReply))) @@ -764,6 +767,8 @@ static inline void __write_reply_hdr_and_rpcbuf( WriteToClient(pClient, hdrLen, hdrData); WriteRpcbufToClient(pClient, rpcbuf); + + return Success; } static inline void __write_reply_hdr_simple(