From 9ce4a417ad8c00761a865e0a60a72edfbfbad617 Mon Sep 17 00:00:00 2001 From: eafton Date: Sun, 5 Oct 2025 01:07:49 +0300 Subject: [PATCH] Add exit code checking to zenitymessagebox. --- src/dialog/unix/SDL_zenitymessagebox.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/dialog/unix/SDL_zenitymessagebox.c b/src/dialog/unix/SDL_zenitymessagebox.c index 01ca673d3c26d..bf9c85b07a6f6 100644 --- a/src/dialog/unix/SDL_zenitymessagebox.c +++ b/src/dialog/unix/SDL_zenitymessagebox.c @@ -158,7 +158,15 @@ bool SDL_Zenity_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *bu return false; } if (buttonID) { - char *output = SDL_ReadProcess(process, NULL, NULL); + int exit_code; + char *output = SDL_ReadProcess(process, NULL, &exit_code); + if (exit_code == 255) { + if (output) { + SDL_free(output); + } + SDL_DestroyProcess(process); + return false; + } if (output) { // It likes to add a newline... char *tmp = SDL_strrchr(output, '\n');