This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git

commit 665db8d32c25ed939f2d89e2d59d642ad57ad73d
Author: Marco Casaroli <[email protected]>
AuthorDate: Fri Oct 23 20:53:13 2026 +0200

    games/NXDoom: Check WIFEXITED() before WEXITSTATUS().
    
    The file selector takes the output of its child as the result only if
    WEXITSTATUS() of the child is 0.  POSIX defines WEXITSTATUS() only when
    WIFEXITED() is true: for a child that a signal ended, the value is not
    an exit code, and it can be 0.
    
    Take the result only if the child exited and its exit status is 0.
    
    Assisted-by: Claude Code:claude-opus-5-5
    Signed-off-by: Marco Casaroli <[email protected]>
---
 games/NXDoom/textscreen/txt_fileselect.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/games/NXDoom/textscreen/txt_fileselect.c 
b/games/NXDoom/textscreen/txt_fileselect.c
index e9ed96029..d27fa4cd0 100644
--- a/games/NXDoom/textscreen/txt_fileselect.c
+++ b/games/NXDoom/textscreen/txt_fileselect.c
@@ -183,9 +183,9 @@ static char *exec_read_output(char **argv)
   close(pipefd[0]);
   close(pipefd[1]);
 
-  /* Must have a success exit code. */
+  /* Must have exited with a success exit code. */
 
-  if (WEXITSTATUS(status) != 0)
+  if (!WIFEXITED(status) || WEXITSTATUS(status) != 0)
     {
       free(result);
       result = NULL;

Reply via email to